aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-12-23 20:41:01 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-12-29 09:31:21 -0500
commit08fd8c1cf0a99abf34e09a8b99b74872e0d73a23 (patch)
treee91ccb6f0b9f6d7fc5e21f7d8c480ff7c19af666 /drivers/cpufreq
parent72368d122c7479aa6e14fbbd334717b8a0c157a6 (diff)
cpufreq: preserve user_policy across suspend/resume
Prevent __cpufreq_add_dev() from overwriting the existing values of user_policy.{min|max|policy|governor} with defaults during resume from system suspend. Fixes: 5302c3fb2e62 ("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>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index f13a663d1da5..8d19f7c06010 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -839,9 +839,6 @@ static void cpufreq_init_policy(struct cpufreq_policy *policy)
839 839
840 /* set default policy */ 840 /* set default policy */
841 ret = cpufreq_set_policy(policy, &new_policy); 841 ret = cpufreq_set_policy(policy, &new_policy);
842 policy->user_policy.policy = policy->policy;
843 policy->user_policy.governor = policy->governor;
844
845 if (ret) { 842 if (ret) {
846 pr_debug("setting policy failed\n"); 843 pr_debug("setting policy failed\n");
847 if (cpufreq_driver->exit) 844 if (cpufreq_driver->exit)
@@ -1071,8 +1068,10 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
1071 */ 1068 */
1072 cpumask_and(policy->cpus, policy->cpus, cpu_online_mask); 1069 cpumask_and(policy->cpus, policy->cpus, cpu_online_mask);
1073 1070
1074 policy->user_policy.min = policy->min; 1071 if (!frozen) {
1075 policy->user_policy.max = policy->max; 1072 policy->user_policy.min = policy->min;
1073 policy->user_policy.max = policy->max;
1074 }
1076 1075
1077 blocking_notifier_call_chain(&cpufreq_policy_notifier_list, 1076 blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
1078 CPUFREQ_START, policy); 1077 CPUFREQ_START, policy);
@@ -1103,6 +1102,11 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
1103 1102
1104 cpufreq_init_policy(policy); 1103 cpufreq_init_policy(policy);
1105 1104
1105 if (!frozen) {
1106 policy->user_policy.policy = policy->policy;
1107 policy->user_policy.governor = policy->governor;
1108 }
1109
1106 kobject_uevent(&policy->kobj, KOBJ_ADD); 1110 kobject_uevent(&policy->kobj, KOBJ_ADD);
1107 up_read(&cpufreq_rwsem); 1111 up_read(&cpufreq_rwsem);
1108 1112