diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-05-13 19:00:28 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-05-30 08:34:16 -0400 |
commit | 9e8c0a899b2f89b8367d33668f6819892f0a00f2 (patch) | |
tree | 56efaf9d3357f4ce768ce2acdcc978ad2fafdc20 /drivers/cpufreq/cpufreq.c | |
parent | d6ff44d647a9c63911983da9979961fde306b3aa (diff) |
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) | |||
2011 | if (!policy->governor) | 2011 | if (!policy->governor) |
2012 | return -EINVAL; | 2012 | return -EINVAL; |
2013 | 2013 | ||
2014 | if (policy->governor->max_transition_latency && | 2014 | if (event == CPUFREQ_GOV_POLICY_INIT) { |
2015 | policy->cpuinfo.transition_latency > | 2015 | if (policy->governor->max_transition_latency && |
2016 | policy->governor->max_transition_latency) { | 2016 | policy->cpuinfo.transition_latency > |
2017 | struct cpufreq_governor *gov = cpufreq_fallback_governor(); | 2017 | policy->governor->max_transition_latency) { |
2018 | 2018 | struct cpufreq_governor *gov = cpufreq_fallback_governor(); | |
2019 | if (gov) { | 2019 | |
2020 | pr_warn("%s governor failed, too long transition latency of HW, fallback to %s governor\n", | 2020 | if (gov) { |
2021 | policy->governor->name, gov->name); | 2021 | pr_warn("%s governor failed, too long transition latency of HW, fallback to %s governor\n", |
2022 | policy->governor = gov; | 2022 | policy->governor->name, gov->name); |
2023 | } else { | 2023 | policy->governor = gov; |
2024 | return -EINVAL; | 2024 | } else { |
2025 | return -EINVAL; | ||
2026 | } | ||
2025 | } | 2027 | } |
2026 | } | ||
2027 | 2028 | ||
2028 | if (event == CPUFREQ_GOV_POLICY_INIT) | ||
2029 | if (!try_module_get(policy->governor->owner)) | 2029 | if (!try_module_get(policy->governor->owner)) |
2030 | return -EINVAL; | 2030 | return -EINVAL; |
2031 | } | ||
2031 | 2032 | ||
2032 | pr_debug("%s: for CPU %u, event %u\n", __func__, policy->cpu, event); | 2033 | pr_debug("%s: for CPU %u, event %u\n", __func__, policy->cpu, event); |
2033 | 2034 | ||