cpufreq: Remove 'policy->governor_enabled'
authorViresh Kumar <viresh.kumar@linaro.org>
Mon, 22 Feb 2016 11:06:44 +0000 (16:36 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 9 Mar 2016 13:41:12 +0000 (14:41 +0100)
The entire sequence of events (like INIT/START or STOP/EXIT) for which
cpufreq_governor() is called, is guaranteed to be protected by
policy->rwsem now.

The additional checks that were added earlier (as we were forced to drop
policy->rwsem before calling cpufreq_governor() for EXIT event), aren't
required anymore.

Over that, they weren't sufficient really. They just take care of
START/STOP events, but not INIT/EXIT and the state machine was never
maintained properly by them.

Kill the unnecessary checks and policy->governor_enabled field.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c
include/linux/cpufreq.h

index b3d05a905034d0596de7a43badc8b476000bbacc..dd568aaf27280fb50e933cd7c4ae1ede8aca6519 100644 (file)
@@ -2010,17 +2010,6 @@ static int cpufreq_governor(struct cpufreq_policy *policy, unsigned int event)
 
        pr_debug("%s: for CPU %u, event %u\n", __func__, policy->cpu, event);
 
-       if ((policy->governor_enabled && event == CPUFREQ_GOV_START)
-           || (!policy->governor_enabled
-           && (event == CPUFREQ_GOV_LIMITS || event == CPUFREQ_GOV_STOP))) {
-               return -EBUSY;
-       }
-
-       if (event == CPUFREQ_GOV_STOP)
-               policy->governor_enabled = false;
-       else if (event == CPUFREQ_GOV_START)
-               policy->governor_enabled = true;
-
        ret = policy->governor->governor(policy, event);
 
        if (!ret) {
@@ -2028,12 +2017,6 @@ static int cpufreq_governor(struct cpufreq_policy *policy, unsigned int event)
                        policy->governor->initialized++;
                else if (event == CPUFREQ_GOV_POLICY_EXIT)
                        policy->governor->initialized--;
-       } else {
-               /* Restore original values */
-               if (event == CPUFREQ_GOV_STOP)
-                       policy->governor_enabled = true;
-               else if (event == CPUFREQ_GOV_START)
-                       policy->governor_enabled = false;
        }
 
        if (((event == CPUFREQ_GOV_POLICY_INIT) && ret) ||
index cac3d1ba82002c3bb9f0ffa6955cf7825fc52645..a50c5b2e3bf2d89f010f27fdc385b1949d413eb1 100644 (file)
@@ -80,7 +80,6 @@ struct cpufreq_policy {
        unsigned int            last_policy; /* policy before unplug */
        struct cpufreq_governor *governor; /* see below */
        void                    *governor_data;
-       bool                    governor_enabled; /* governor start/stop flag */
        char                    last_governor[CPUFREQ_NAME_LEN]; /* last governor used */
 
        struct work_struct      update; /* if update_policy() needs to be