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

PM / devfreq: tegra30: use min to simplify actmon_cpu_to_emc_rate

Use min() to improve the readability of actmon_cpu_to_emc_rate() and
remove any unnecessary curly braces.

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Link: https://patchwork.kernel.org/project/linux-pm/patch/20251112172121.3741-2-thorsten.blum@linux.dev/

authored by

Thorsten Blum and committed by
Chanwoo Choi
dc30fe7a 26dd44a4

+4 -8
+4 -8
drivers/devfreq/tegra30-devfreq.c
··· 13 13 #include <linux/interrupt.h> 14 14 #include <linux/io.h> 15 15 #include <linux/irq.h> 16 + #include <linux/minmax.h> 16 17 #include <linux/module.h> 17 18 #include <linux/of.h> 18 19 #include <linux/platform_device.h> ··· 326 325 unsigned int i; 327 326 const struct tegra_actmon_emc_ratio *ratio = actmon_emc_ratios; 328 327 329 - for (i = 0; i < ARRAY_SIZE(actmon_emc_ratios); i++, ratio++) { 330 - if (cpu_freq >= ratio->cpu_freq) { 331 - if (ratio->emc_freq >= tegra->max_freq) 332 - return tegra->max_freq; 333 - else 334 - return ratio->emc_freq; 335 - } 336 - } 328 + for (i = 0; i < ARRAY_SIZE(actmon_emc_ratios); i++, ratio++) 329 + if (cpu_freq >= ratio->cpu_freq) 330 + return min(ratio->emc_freq, tegra->max_freq); 337 331 338 332 return 0; 339 333 }