[PATCH] cpufreq: Skip all governor-related actions for cpufreq_suspended set

From: Rafael J. Wysocki
Date: Wed Apr 06 2016 - 21:27:01 EST


From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>

Since governor operations are generally skipped if cpufreq_suspended
is set, do nothing at all in cpufreq_start_governor() and
cpufreq_exit_governor() in that case.

In particular, this prevents fast frequency switching from being
disabled after a suspend-to-RAM cycle on all CPUs except for the
boot one.

Fixes: b7898fda5bc7 (cpufreq: Support for fast frequency switching)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
---
drivers/cpufreq/cpufreq.c | 6 ++++++
1 file changed, 6 insertions(+)

Index: linux-pm/drivers/cpufreq/cpufreq.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/cpufreq.c
+++ linux-pm/drivers/cpufreq/cpufreq.c
@@ -2053,6 +2053,9 @@ static int cpufreq_start_governor(struct
{
int ret;

+ if (cpufreq_suspended)
+ return 0;
+
if (cpufreq_driver->get && !cpufreq_driver->setpolicy)
cpufreq_update_current_freq(policy);

@@ -2062,6 +2065,9 @@ static int cpufreq_start_governor(struct

static int cpufreq_exit_governor(struct cpufreq_policy *policy)
{
+ if (cpufreq_suspended)
+ return 0;
+
cpufreq_disable_fast_switch(policy);
return cpufreq_governor(policy, CPUFREQ_GOV_POLICY_EXIT);
}