Skip to content

Commit 97148d0

Browse files
vireshkrafaeljw
authored andcommitted
cpufreq: Improve code around unlisted freq check
The cpufreq core checks if the frequency programmed by the bootloaders is not listed in the freq table and programs one from the table in such a case. This is done only if the driver has set the CPUFREQ_NEED_INITIAL_FREQ_CHECK flag. Currently we print two separate messages, with almost the same content, and do this with a pr_warn() which may be a bit too much as the driver only asked us to check this as it expected this to be the case. Lower down the severity of the print message by switching to pr_info() instead and print a single message only. Reported-by: Sumit Gupta <sumitg@nvidia.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Sumit Gupta <sumitg@nvidia.com> Tested-by: Sumit Gupta <sumitg@nvidia.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 0b8417c commit 97148d0

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

drivers/cpufreq/cpufreq.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,23 +1454,22 @@ static int cpufreq_online(unsigned int cpu)
14541454
*/
14551455
if ((cpufreq_driver->flags & CPUFREQ_NEED_INITIAL_FREQ_CHECK)
14561456
&& has_target()) {
1457+
unsigned int old_freq = policy->cur;
1458+
14571459
/* Are we running at unknown frequency ? */
1458-
ret = cpufreq_frequency_table_get_index(policy, policy->cur);
1460+
ret = cpufreq_frequency_table_get_index(policy, old_freq);
14591461
if (ret == -EINVAL) {
1460-
/* Warn user and fix it */
1461-
pr_warn("%s: CPU%d: Running at unlisted freq: %u KHz\n",
1462-
__func__, policy->cpu, policy->cur);
1463-
ret = __cpufreq_driver_target(policy, policy->cur - 1,
1464-
CPUFREQ_RELATION_L);
1462+
ret = __cpufreq_driver_target(policy, old_freq - 1,
1463+
CPUFREQ_RELATION_L);
14651464

14661465
/*
14671466
* Reaching here after boot in a few seconds may not
14681467
* mean that system will remain stable at "unknown"
14691468
* frequency for longer duration. Hence, a BUG_ON().
14701469
*/
14711470
BUG_ON(ret);
1472-
pr_warn("%s: CPU%d: Unlisted initial frequency changed to: %u KHz\n",
1473-
__func__, policy->cpu, policy->cur);
1471+
pr_info("%s: CPU%d: Running at unlisted initial frequency: %u KHz, changing to: %u KHz\n",
1472+
__func__, policy->cpu, old_freq, policy->cur);
14741473
}
14751474
}
14761475

0 commit comments

Comments
 (0)