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

Configure Feed

Select the types of activity you want to include in your feed.

PM / devfreq: Limit max_freq with scaling_min_freq

Limit max_freq in devfreq_get_freq_range() with scaling_min_freq to avoid
showing an unreachable freq when reading it.

Use macro clamp to simplify code.

Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
Link: https://lore.kernel.org/lkml/20250421030020.3108405-3-zhenglifeng1@huawei.com/
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

authored by

Lifeng Zheng and committed by
Chanwoo Choi
5487f259 914cc799

+2 -5
+2 -5
drivers/devfreq/devfreq.c
··· 152 152 (unsigned long)HZ_PER_KHZ * qos_max_freq); 153 153 154 154 /* Apply constraints from OPP interface */ 155 - *min_freq = max(*min_freq, devfreq->scaling_min_freq); 156 - *max_freq = min(*max_freq, devfreq->scaling_max_freq); 157 - 158 - if (*min_freq > *max_freq) 159 - *min_freq = *max_freq; 155 + *max_freq = clamp(*max_freq, devfreq->scaling_min_freq, devfreq->scaling_max_freq); 156 + *min_freq = clamp(*min_freq, devfreq->scaling_min_freq, *max_freq); 160 157 } 161 158 EXPORT_SYMBOL(devfreq_get_freq_range); 162 159