diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2012-10-24 17:39:48 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-14 18:33:07 -0500 |
commit | 0676f7f2e7d2adec11f40320ca43a8897b8ef906 (patch) | |
tree | ac9237b4557865cf921e84d94f7c063161d103b0 /drivers/cpufreq/cpufreq.c | |
parent | 8636fd280e970696be62c8495a5aacb5f3b6237d (diff) |
cpufreq: return early from __cpufreq_driver_getavg()
There is no need to do cpufreq_get_cpu() and cpufreq_put_cpu() for drivers that
don't support getavg() routine.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 85df5387bc61..f552d5fe0f8f 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1511,12 +1511,14 @@ int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu) | |||
1511 | { | 1511 | { |
1512 | int ret = 0; | 1512 | int ret = 0; |
1513 | 1513 | ||
1514 | if (!(cpu_online(cpu) && cpufreq_driver->getavg)) | ||
1515 | return 0; | ||
1516 | |||
1514 | policy = cpufreq_cpu_get(policy->cpu); | 1517 | policy = cpufreq_cpu_get(policy->cpu); |
1515 | if (!policy) | 1518 | if (!policy) |
1516 | return -EINVAL; | 1519 | return -EINVAL; |
1517 | 1520 | ||
1518 | if (cpu_online(cpu) && cpufreq_driver->getavg) | 1521 | ret = cpufreq_driver->getavg(policy, cpu); |
1519 | ret = cpufreq_driver->getavg(policy, cpu); | ||
1520 | 1522 | ||
1521 | cpufreq_cpu_put(policy); | 1523 | cpufreq_cpu_put(policy); |
1522 | return ret; | 1524 | return ret; |