diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-05-14 01:00:28 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-05-30 14:34:16 +0200 |
commit | 9e8c0a899b2f89b8367d33668f6819892f0a00f2 (patch) | |
tree | 56efaf9d3357f4ce768ce2acdcc978ad2fafdc20 /drivers/cpufreq/cpufreq.c | |
parent | d6ff44d647a9c63911983da9979961fde306b3aa (diff) | |
download | blackbird-op-linux-9e8c0a899b2f89b8367d33668f6819892f0a00f2.tar.gz blackbird-op-linux-9e8c0a899b2f89b8367d33668f6819892f0a00f2.zip |
cpufreq: governor: Check transition latecy at init time only
It is not necessary to check the governor's max_transition_latency
attribute every time cpufreq_governor() runs, so check it only if
the event argument is CPUFREQ_GOV_POLICY_INIT.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index e3e666109e21..a5f1d016d473 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2011,23 +2011,24 @@ static int cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) if (!policy->governor) return -EINVAL; - if (policy->governor->max_transition_latency && - policy->cpuinfo.transition_latency > - policy->governor->max_transition_latency) { - struct cpufreq_governor *gov = cpufreq_fallback_governor(); - - if (gov) { - pr_warn("%s governor failed, too long transition latency of HW, fallback to %s governor\n", - policy->governor->name, gov->name); - policy->governor = gov; - } else { - return -EINVAL; + if (event == CPUFREQ_GOV_POLICY_INIT) { + if (policy->governor->max_transition_latency && + policy->cpuinfo.transition_latency > + policy->governor->max_transition_latency) { + struct cpufreq_governor *gov = cpufreq_fallback_governor(); + + if (gov) { + pr_warn("%s governor failed, too long transition latency of HW, fallback to %s governor\n", + policy->governor->name, gov->name); + policy->governor = gov; + } else { + return -EINVAL; + } } - } - if (event == CPUFREQ_GOV_POLICY_INIT) if (!try_module_get(policy->governor->owner)) return -EINVAL; + } pr_debug("%s: for CPU %u, event %u\n", __func__, policy->cpu, event); |