Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd: make some function-local tables static const

These tables were initialized on stack on each call, avoid that
and save a little bit of text size.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Nils Wallménius <nils.wallmenius@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Nils Wallménius and committed by
Alex Deucher
aeba709a e90b6227

+6 -6
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c
··· 141 141 void amdgpu_benchmark(struct amdgpu_device *adev, int test_number) 142 142 { 143 143 int i; 144 - int common_modes[AMDGPU_BENCHMARK_COMMON_MODES_N] = { 144 + static const int common_modes[AMDGPU_BENCHMARK_COMMON_MODES_N] = { 145 145 640 * 480 * 4, 146 146 720 * 480 * 4, 147 147 800 * 600 * 4,
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
··· 439 439 struct drm_display_mode *mode = NULL; 440 440 struct drm_display_mode *native_mode = &amdgpu_encoder->native_mode; 441 441 int i; 442 - struct mode_size { 442 + static const struct mode_size { 443 443 int w; 444 444 int h; 445 445 } common_modes[17] = {
+4 -4
drivers/gpu/drm/amd/powerplay/hwmgr/ppevvmath.h
··· 127 127 fInt solution = fPositiveOne; /*Starting off with baseline of 1 */ 128 128 fInt error_term; 129 129 130 - uint32_t k_array[11] = {55452, 27726, 13863, 6931, 4055, 2231, 1178, 606, 308, 155, 78}; 131 - uint32_t expk_array[11] = {2560000, 160000, 40000, 20000, 15000, 12500, 11250, 10625, 10313, 10156, 10078}; 130 + static const uint32_t k_array[11] = {55452, 27726, 13863, 6931, 4055, 2231, 1178, 606, 308, 155, 78}; 131 + static const uint32_t expk_array[11] = {2560000, 160000, 40000, 20000, 15000, 12500, 11250, 10625, 10313, 10156, 10078}; 132 132 133 133 if (GreaterThan(fZERO, exponent)) { 134 134 exponent = fNegate(exponent); ··· 162 162 fInt solution = ConvertToFraction(0); /*Starting off with baseline of 0 */ 163 163 fInt error_term; 164 164 165 - uint32_t k_array[10] = {160000, 40000, 20000, 15000, 12500, 11250, 10625, 10313, 10156, 10078}; 166 - uint32_t logk_array[10] = {27726, 13863, 6931, 4055, 2231, 1178, 606, 308, 155, 78}; 165 + static const uint32_t k_array[10] = {160000, 40000, 20000, 15000, 12500, 11250, 10625, 10313, 10156, 10078}; 166 + static const uint32_t logk_array[10] = {27726, 13863, 6931, 4055, 2231, 1178, 606, 308, 155, 78}; 167 167 168 168 while (GreaterThan(fAdd(value, fNegativeOne), upper_bound)) { 169 169 for (i = 0; i < 10; i++) {