Skip to content

Commit

Permalink
cpufreq: preserve user_policy across suspend/resume
Browse files Browse the repository at this point in the history
Prevent __cpufreq_add_dev() from overwriting the existing values of
user_policy.{min|max|policy|governor} with defaults during resume
from system suspend.

Fixes: 5302c3f ("cpufreq: Perform light-weight init/teardown during suspend/resume")
Reported-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: 3.12+ <stable@vger.kernel.org> # 3.12+
[rjw: Changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
vireshk authored and rafaeljw committed Dec 29, 2013
1 parent 72368d1 commit 08fd8c1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -839,9 +839,6 @@ static void cpufreq_init_policy(struct cpufreq_policy *policy)

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

if (ret) {
pr_debug("setting policy failed\n");
if (cpufreq_driver->exit)
Expand Down Expand Up @@ -1071,8 +1068,10 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
*/
cpumask_and(policy->cpus, policy->cpus, cpu_online_mask);

policy->user_policy.min = policy->min;
policy->user_policy.max = policy->max;
if (!frozen) {
policy->user_policy.min = policy->min;
policy->user_policy.max = policy->max;
}

blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
CPUFREQ_START, policy);
Expand Down Expand Up @@ -1103,6 +1102,11 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,

cpufreq_init_policy(policy);

if (!frozen) {
policy->user_policy.policy = policy->policy;
policy->user_policy.governor = policy->governor;
}

kobject_uevent(&policy->kobj, KOBJ_ADD);
up_read(&cpufreq_rwsem);

Expand Down

0 comments on commit 08fd8c1

Please sign in to comment.