On Mon, Nov 27, 2023 at 5:09 PM Beata Michalska <beata.michalska@xxxxxxx> wrote: > > From: Sumit Gupta <sumitg@xxxxxxxxxx> > > When available, use arch_freq_get_on_cpu to obtain current frequency > (usually an average reported over given period of time) > to better align the cpufreq's view on the current state of affairs. And why is this a good idea? Any problem statement? > This also automatically pulls in the update for cpuinfo_cur_freq sysfs > attribute, aligning it with the scaling_cur_freq one, and thus providing > consistent view on relevant platforms. I have no idea what the above is supposed to mean, sorry. > Signed-off-by: Sumit Gupta <sumitg@xxxxxxxxxx> > [BM: Subject & commit msg] > Signed-off-by: Beata Michalska <beata.michalska@xxxxxxx> > --- > drivers/cpufreq/cpufreq.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 8c4f9c2f9c44..109559438f45 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -1756,7 +1756,8 @@ static unsigned int cpufreq_verify_current_freq(struct cpufreq_policy *policy, b > { > unsigned int new_freq; > > - new_freq = cpufreq_driver->get(policy->cpu); > + new_freq = arch_freq_get_on_cpu(policy->cpu); > + new_freq = new_freq ?: cpufreq_driver->get(policy->cpu); Please don't use ?: in general and it is not even useful here AFAICS. What would be wrong with new_freq = arch_freq_get_on_cpu(policy->cpu); if (!new_freq) new_freq = cpufreq_driver->get(policy->cpu); ? > if (!new_freq) > return 0; > > --