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

cpufreq: armada-37xx: use max() to calculate target_vm

Use max() macro while calculating target_vm to simplify and improve the
armada-37xx-cpufreq driver code.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202503251256.rrl65HgY-lkp@intel.com/
Reported-by: Yang Ruibin <11162571@vivo.com>
Closes: https://lore.kernel.org/lkml/2c55fb07-b29e-43e0-8697-f75d1f0df89a@vivo.com/
Signed-off-by: Akhilesh Patil <akhilesh@ee.iitb.ac.in>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

authored by

Akhilesh Patil and committed by
Viresh Kumar
17bd9599 8640689f

+2 -2
+2 -2
drivers/cpufreq/armada-37xx-cpufreq.c
··· 265 265 */ 266 266 267 267 target_vm = avs_map[l0_vdd_min] - 100; 268 - target_vm = target_vm > MIN_VOLT_MV ? target_vm : MIN_VOLT_MV; 268 + target_vm = max(target_vm, MIN_VOLT_MV); 269 269 dvfs->avs[1] = armada_37xx_avs_val_match(target_vm); 270 270 271 271 /* ··· 273 273 * be larger than 1000mv 274 274 */ 275 275 target_vm = avs_map[l0_vdd_min] - 150; 276 - target_vm = target_vm > MIN_VOLT_MV ? target_vm : MIN_VOLT_MV; 276 + target_vm = max(target_vm, MIN_VOLT_MV); 277 277 dvfs->avs[2] = dvfs->avs[3] = armada_37xx_avs_val_match(target_vm); 278 278 279 279 /*