Commit a262e94c authored by Viresh Kumar's avatar Viresh Kumar Committed by Rafael J. Wysocki

cpufreq: remove unnecessary cpufreq_cpu_{get|put}() calls

struct cpufreq_policy is already passed as argument to some routines
like: __cpufreq_driver_getavg() and so we don't really need to do
cpufreq_cpu_get() before and cpufreq_cpu_put() in them to get a
policy structure.

Remove them.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 27209d91
...@@ -1572,10 +1572,6 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, ...@@ -1572,10 +1572,6 @@ int cpufreq_driver_target(struct cpufreq_policy *policy,
{ {
int ret = -EINVAL; int ret = -EINVAL;
policy = cpufreq_cpu_get(policy->cpu);
if (!policy)
goto no_policy;
if (unlikely(lock_policy_rwsem_write(policy->cpu))) if (unlikely(lock_policy_rwsem_write(policy->cpu)))
goto fail; goto fail;
...@@ -1584,30 +1580,19 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, ...@@ -1584,30 +1580,19 @@ int cpufreq_driver_target(struct cpufreq_policy *policy,
unlock_policy_rwsem_write(policy->cpu); unlock_policy_rwsem_write(policy->cpu);
fail: fail:
cpufreq_cpu_put(policy);
no_policy:
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(cpufreq_driver_target); EXPORT_SYMBOL_GPL(cpufreq_driver_target);
int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu) int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu)
{ {
int ret = 0;
if (cpufreq_disabled()) if (cpufreq_disabled())
return ret; return 0;
if (!cpufreq_driver->getavg) if (!cpufreq_driver->getavg)
return 0; return 0;
policy = cpufreq_cpu_get(policy->cpu); return cpufreq_driver->getavg(policy, cpu);
if (!policy)
return -EINVAL;
ret = cpufreq_driver->getavg(policy, cpu);
cpufreq_cpu_put(policy);
return ret;
} }
EXPORT_SYMBOL_GPL(__cpufreq_driver_getavg); EXPORT_SYMBOL_GPL(__cpufreq_driver_getavg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment