From: Colin Ian King Date: Thu, 3 Nov 2022 15:04:31 +0000 (+0000) Subject: cpufreq: longhaul: Make array speeds static const X-Git-Tag: v6.6.17~6022^2~3^2~7^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=59fdc42793252852e1ca95d1355e9ed0fc2a0612;p=platform%2Fkernel%2Flinux-rpi.git cpufreq: longhaul: Make array speeds static const Don't populate the read-only array speeds on the stack but instead make it static. Also makes the object code a little smaller. Replace hard-coded loop array bounds with ARRAY_SIZE. Signed-off-by: Colin Ian King Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c index 3e000e1..4c57c67 100644 --- a/drivers/cpufreq/longhaul.c +++ b/drivers/cpufreq/longhaul.c @@ -407,10 +407,10 @@ static int guess_fsb(int mult) { int speed = cpu_khz / 1000; int i; - int speeds[] = { 666, 1000, 1333, 2000 }; + static const int speeds[] = { 666, 1000, 1333, 2000 }; int f_max, f_min; - for (i = 0; i < 4; i++) { + for (i = 0; i < ARRAY_SIZE(speeds); i++) { f_max = ((speeds[i] * mult) + 50) / 100; f_max += (ROUNDING / 2); f_min = f_max - ROUNDING;