Skip to content

Commit 8f13c0c

Browse files
vireshkrafaeljw
authored andcommitted
cpufreq: Don't skip cpufreq_frequency_table_cpuinfo()
The commit 6db0f53 ("cpufreq: preserve freq_table_sorted across suspend/hibernate") unintentionally made a change where cpufreq_frequency_table_cpuinfo() isn't getting called anymore for old policies getting re-initialized. This leads to potentially invalid values of policy->max and policy->cpuinfo_max_freq. Fix the issue by reverting the original commit and adding the condition for just the sorting function. Fixes: 6db0f53 ("cpufreq: preserve freq_table_sorted across suspend/hibernate") Signed-off-by: Viresh Kumar <[email protected]> Cc: 6.19+ <[email protected]> # 6.19+ Link: https://patch.msgid.link/65ba5c45749267c82e8a87af3dc788b37a0b3f48.1773998611.git.viresh.kumar@linaro.org Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent c369299 commit 8f13c0c

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

drivers/cpufreq/cpufreq.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,12 +1427,9 @@ static int cpufreq_policy_online(struct cpufreq_policy *policy,
14271427
* If there is a problem with its frequency table, take it
14281428
* offline and drop it.
14291429
*/
1430-
if (policy->freq_table_sorted != CPUFREQ_TABLE_SORTED_ASCENDING &&
1431-
policy->freq_table_sorted != CPUFREQ_TABLE_SORTED_DESCENDING) {
1432-
ret = cpufreq_table_validate_and_sort(policy);
1433-
if (ret)
1434-
goto out_offline_policy;
1435-
}
1430+
ret = cpufreq_table_validate_and_sort(policy);
1431+
if (ret)
1432+
goto out_offline_policy;
14361433

14371434
/* related_cpus should at least include policy->cpus. */
14381435
cpumask_copy(policy->related_cpus, policy->cpus);

drivers/cpufreq/freq_table.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,10 @@ int cpufreq_table_validate_and_sort(struct cpufreq_policy *policy)
360360
if (policy_has_boost_freq(policy))
361361
policy->boost_supported = true;
362362

363+
if (policy->freq_table_sorted == CPUFREQ_TABLE_SORTED_ASCENDING ||
364+
policy->freq_table_sorted == CPUFREQ_TABLE_SORTED_DESCENDING)
365+
return 0;
366+
363367
return set_freq_table_sorted(policy);
364368
}
365369

0 commit comments

Comments
 (0)