Skip to content

Commit

Permalink
drivers: cpufreq: address issue where cpus forget their clock speeds
Browse files Browse the repository at this point in the history
  • Loading branch information
showp1984 authored and Snuzzo committed Dec 30, 2012
1 parent 2190b55 commit f7abce7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
unsigned long flags;
unsigned int j;
#ifdef CONFIG_HOTPLUG_CPU
struct cpufreq_policy *cp;
int sibling;
#endif

Expand Down Expand Up @@ -1017,10 +1018,14 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
/* Set governor before ->init, so that driver could check it */
#ifdef CONFIG_HOTPLUG_CPU
for_each_online_cpu(sibling) {
struct cpufreq_policy *cp = per_cpu(cpufreq_cpu_data, sibling);
cp = per_cpu(cpufreq_cpu_data, sibling);
if (cp && cp->governor &&
(cpumask_test_cpu(cpu, cp->related_cpus))) {
policy->governor = cp->governor;
policy->min = cp->min;
policy->max = cp->max;
policy->user_policy.min = cp->user_policy.min;
policy->user_policy.max = cp->user_policy.max;
found = 1;
break;
}
Expand All @@ -1039,6 +1044,14 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
policy->user_policy.min = policy->min;
policy->user_policy.max = policy->max;

if (found) {
/* Calling the driver can overwrite policy frequencies again */
policy->min = cp->min;
policy->max = cp->max;
policy->user_policy.min = cp->user_policy.min;
policy->user_policy.max = cp->user_policy.max;
}

blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
CPUFREQ_START, policy);

Expand Down

0 comments on commit f7abce7

Please sign in to comment.