Browse Source

cpufreq: fix cpufreq suspend/resume for intel_pstate

Cpufreq core introduces cpufreq_suspended flag to let cpufreq sysfs nodes
across S2RAM/S2DISK. But the flag is only set in the cpufreq_suspend()
for cpufreq drivers which have target or target_index callback. This
skips intel_pstate driver. This patch is to set the flag before checking
target or target_index callback.

Fixes: 2f0aea936360 (cpufreq: suspend governors on system suspend/hibernate)
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Cc: 3.15+ <stable@vger.kernel.org> # 3.15+
[rjw: Subject]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Lan Tianyu 11 years ago
parent
commit
8e30444e15
1 changed files with 4 additions and 4 deletions
  1. 4 4
      drivers/cpufreq/cpufreq.c

+ 4 - 4
drivers/cpufreq/cpufreq.c

@@ -1656,6 +1656,8 @@ void cpufreq_suspend(void)
 	if (!cpufreq_driver)
 	if (!cpufreq_driver)
 		return;
 		return;
 
 
+	cpufreq_suspended = true;
+
 	if (!has_target())
 	if (!has_target())
 		return;
 		return;
 
 
@@ -1670,8 +1672,6 @@ void cpufreq_suspend(void)
 			pr_err("%s: Failed to suspend driver: %p\n", __func__,
 			pr_err("%s: Failed to suspend driver: %p\n", __func__,
 				policy);
 				policy);
 	}
 	}
-
-	cpufreq_suspended = true;
 }
 }
 
 
 /**
 /**
@@ -1687,13 +1687,13 @@ void cpufreq_resume(void)
 	if (!cpufreq_driver)
 	if (!cpufreq_driver)
 		return;
 		return;
 
 
+	cpufreq_suspended = false;
+
 	if (!has_target())
 	if (!has_target())
 		return;
 		return;
 
 
 	pr_debug("%s: Resuming Governors\n", __func__);
 	pr_debug("%s: Resuming Governors\n", __func__);
 
 
-	cpufreq_suspended = false;
-
 	list_for_each_entry(policy, &cpufreq_policy_list, policy_list) {
 	list_for_each_entry(policy, &cpufreq_policy_list, policy_list) {
 		if (cpufreq_driver->resume && cpufreq_driver->resume(policy))
 		if (cpufreq_driver->resume && cpufreq_driver->resume(policy))
 			pr_err("%s: Failed to resume driver: %p\n", __func__,
 			pr_err("%s: Failed to resume driver: %p\n", __func__,