Skip to content

Commit

Permalink
[CPUFREQ] Fix limited cpufreq when booted on battery
Browse files Browse the repository at this point in the history
References:
https://bugzilla.novell.com/show_bug.cgi?id=231107
https://bugzilla.novell.com/show_bug.cgi?id=264077

Fix limited cpufreq when booted on battery

If booted on battery:
cpufreq_set_policy (evil) is invoked which calls verify_within_limits.
max_freq gets lowered and therefore users_policy.max, which
is used to restore higher freqs via update_policy later is set to the
already limited frequency -> you can never go up again, even BIOS
allows higher freqs later.

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Dave Jones <davej@redhat.com>
  • Loading branch information
Thomas Renninger authored and Dave Jones committed Apr 26, 2007
1 parent e8e4919 commit 22c970f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,9 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
unlock_policy_rwsem_write(cpu);
goto err_out;
}
policy->user_policy.min = policy->cpuinfo.min_freq;
policy->user_policy.max = policy->cpuinfo.max_freq;
policy->user_policy.governor = policy->governor;

#ifdef CONFIG_SMP
for_each_cpu_mask(j, policy->cpus) {
Expand Down Expand Up @@ -858,10 +861,13 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)

policy->governor = NULL; /* to assure that the starting sequence is
* run in cpufreq_set_policy */
unlock_policy_rwsem_write(cpu);

/* set default policy */
ret = cpufreq_set_policy(&new_policy);
ret = __cpufreq_set_policy(policy, &new_policy);
policy->user_policy.policy = policy->policy;

unlock_policy_rwsem_write(cpu);

if (ret) {
dprintk("setting policy failed\n");
goto err_out_unregister;
Expand Down

0 comments on commit 22c970f

Please sign in to comment.