diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-09-15 20:17:49 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-09-15 20:17:49 -0400 |
commit | 1f0bd44e937468446d080b98b5669844744c24a1 (patch) | |
tree | 74168ece217e8bf201daa329f28db8a83fbe4616 | |
parent | 6ff33f3902c3b1c5d0db6b1e2c70b6d76fba357f (diff) |
cpufreq: acpi-cpufreq: Use cpufreq_cpu_get_raw() in ->get()
cpufreq_cpu_get() called by get_cur_freq_on_cpu() is overkill,
because the ->get() callback is always invoked in a context in
which all of the conditions checked by cpufreq_cpu_get() are
guaranteed to be satisfied.
Use cpufreq_cpu_get_raw() instead of it and drop the
corresponding cpufreq_cpu_put() from get_cur_freq_on_cpu().
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
-rw-r--r-- | drivers/cpufreq/acpi-cpufreq.c | 3 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 4 | ||||
-rw-r--r-- | include/linux/cpufreq.h | 5 |
3 files changed, 8 insertions, 4 deletions
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 15b921a9248c..798277227de7 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c | |||
@@ -375,12 +375,11 @@ static unsigned int get_cur_freq_on_cpu(unsigned int cpu) | |||
375 | 375 | ||
376 | pr_debug("get_cur_freq_on_cpu (%d)\n", cpu); | 376 | pr_debug("get_cur_freq_on_cpu (%d)\n", cpu); |
377 | 377 | ||
378 | policy = cpufreq_cpu_get(cpu); | 378 | policy = cpufreq_cpu_get_raw(cpu); |
379 | if (unlikely(!policy)) | 379 | if (unlikely(!policy)) |
380 | return 0; | 380 | return 0; |
381 | 381 | ||
382 | data = policy->driver_data; | 382 | data = policy->driver_data; |
383 | cpufreq_cpu_put(policy); | ||
384 | if (unlikely(!data || !data->freq_table)) | 383 | if (unlikely(!data || !data->freq_table)) |
385 | return 0; | 384 | return 0; |
386 | 385 | ||
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 6633b3fa996e..ef5ed9470de9 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -238,13 +238,13 @@ int cpufreq_generic_init(struct cpufreq_policy *policy, | |||
238 | } | 238 | } |
239 | EXPORT_SYMBOL_GPL(cpufreq_generic_init); | 239 | EXPORT_SYMBOL_GPL(cpufreq_generic_init); |
240 | 240 | ||
241 | /* Only for cpufreq core internal use */ | 241 | struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu) |
242 | static struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu) | ||
243 | { | 242 | { |
244 | struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); | 243 | struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); |
245 | 244 | ||
246 | return policy && cpumask_test_cpu(cpu, policy->cpus) ? policy : NULL; | 245 | return policy && cpumask_test_cpu(cpu, policy->cpus) ? policy : NULL; |
247 | } | 246 | } |
247 | EXPORT_SYMBOL_GPL(cpufreq_cpu_get_raw); | ||
248 | 248 | ||
249 | unsigned int cpufreq_generic_get(unsigned int cpu) | 249 | unsigned int cpufreq_generic_get(unsigned int cpu) |
250 | { | 250 | { |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 430efcbea48e..dca22de98d94 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -127,9 +127,14 @@ struct cpufreq_policy { | |||
127 | #define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/ | 127 | #define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/ |
128 | 128 | ||
129 | #ifdef CONFIG_CPU_FREQ | 129 | #ifdef CONFIG_CPU_FREQ |
130 | struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu); | ||
130 | struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu); | 131 | struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu); |
131 | void cpufreq_cpu_put(struct cpufreq_policy *policy); | 132 | void cpufreq_cpu_put(struct cpufreq_policy *policy); |
132 | #else | 133 | #else |
134 | static inline struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu) | ||
135 | { | ||
136 | return NULL; | ||
137 | } | ||
133 | static inline struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu) | 138 | static inline struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu) |
134 | { | 139 | { |
135 | return NULL; | 140 | return NULL; |