linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] cpufreq: return early from __cpufreq_driver_getavg()
@ 2012-10-19 20:12 Viresh Kumar
  2012-10-19 20:12 ` [PATCH 2/2] cpufreq: governors: remove redundant code Viresh Kumar
  2012-10-19 22:11 ` [PATCH 1/2] cpufreq: return early from __cpufreq_driver_getavg() Rafael J. Wysocki
  0 siblings, 2 replies; 13+ messages in thread
From: Viresh Kumar @ 2012-10-19 20:12 UTC (permalink / raw)
  To: rjw
  Cc: cpufreq, linux-pm, linux-kernel, linux-arm-kernel, linaro-dev,
	patches, pdsw-power-team, arvind.chauhan, Viresh Kumar

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>
---
 drivers/cpufreq/cpufreq.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 85df538..f552d5f 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)
 {
 	int ret = 0;
 
+	if (!(cpu_online(cpu) && cpufreq_driver->getavg))
+		return 0;
+
 	policy = cpufreq_cpu_get(policy->cpu);
 	if (!policy)
 		return -EINVAL;
 
-	if (cpu_online(cpu) && cpufreq_driver->getavg)
-		ret = cpufreq_driver->getavg(policy, cpu);
+	ret = cpufreq_driver->getavg(policy, cpu);
 
 	cpufreq_cpu_put(policy);
 	return ret;
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-11-23 13:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-19 20:12 [PATCH 1/2] cpufreq: return early from __cpufreq_driver_getavg() Viresh Kumar
2012-10-19 20:12 ` [PATCH 2/2] cpufreq: governors: remove redundant code Viresh Kumar
2012-10-22  8:46   ` Viresh Kumar
2012-10-24  6:07     ` Viresh Kumar
2012-10-24 19:43       ` Rafael J. Wysocki
2012-10-24 21:12         ` Rafael J. Wysocki
2012-10-25  3:29           ` Viresh Kumar
2012-10-26  0:13             ` Rafael J. Wysocki
2012-10-26  3:28               ` Viresh Kumar
2012-11-23 13:00   ` Fabio Baltieri
2012-10-19 22:11 ` [PATCH 1/2] cpufreq: return early from __cpufreq_driver_getavg() Rafael J. Wysocki
     [not found]   ` <CAKohponGwhC_zmk1Whq56vmZMvjcxXKiSpdvMk4ZU8z0Wa2TBw@mail.gmail.com>
2012-10-20  7:09     ` Viresh Kumar
2012-10-24 22:02     ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).