All of lore.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: rjw@sisk.pl
Cc: cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linaro-dev@lists.linaro.org, patches@linaro.org,
	pdsw-power-team@arm.com, arvind.chauhan@arm.com,
	Viresh Kumar <viresh.kumar@linaro.org>
Subject: [PATCH 1/2] cpufreq: return early from __cpufreq_driver_getavg()
Date: Sat, 20 Oct 2012 01:42:05 +0530	[thread overview]
Message-ID: <32e5bed743cc6cc4e614291a7080299f5f0d0933.1350677395.git.viresh.kumar@linaro.org> (raw)

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


WARNING: multiple messages have this Message-ID (diff)
From: viresh.kumar@linaro.org (Viresh Kumar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] cpufreq: return early from __cpufreq_driver_getavg()
Date: Sat, 20 Oct 2012 01:42:05 +0530	[thread overview]
Message-ID: <32e5bed743cc6cc4e614291a7080299f5f0d0933.1350677395.git.viresh.kumar@linaro.org> (raw)

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

             reply	other threads:[~2012-10-19 20:12 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-19 20:12 Viresh Kumar [this message]
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-19 20:12   ` Viresh Kumar
2012-10-19 20:12   ` Viresh Kumar
2012-10-22  8:46   ` Viresh Kumar
2012-10-22  8:46     ` Viresh Kumar
2012-10-24  6:07     ` Viresh Kumar
2012-10-24  6:07       ` Viresh Kumar
2012-10-24 19:43       ` Rafael J. Wysocki
2012-10-24 19:43         ` Rafael J. Wysocki
2012-10-24 21:12         ` Rafael J. Wysocki
2012-10-24 21:12           ` Rafael J. Wysocki
2012-10-25  3:29           ` Viresh Kumar
2012-10-25  3:29             ` Viresh Kumar
2012-10-26  0:13             ` Rafael J. Wysocki
2012-10-26  0:13               ` Rafael J. Wysocki
2012-10-26  0:13               ` Rafael J. Wysocki
2012-10-26  3:28               ` Viresh Kumar
2012-10-26  3:28                 ` Viresh Kumar
2012-11-23 13:00   ` Fabio Baltieri
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
2012-10-19 22:11   ` Rafael J. Wysocki
     [not found]   ` <2737823.2JYE7UmLRN-sKB8Sp2ER+y1GS7QM15AGw@public.gmane.org>
2012-10-20  4:42     ` Viresh Kumar
2012-10-20  4:42       ` Viresh Kumar
2012-10-20  7:09       ` Viresh Kumar
2012-10-20  7:09         ` Viresh Kumar
2012-10-24 22:02       ` Rafael J. Wysocki
2012-10-24 22:02         ` Rafael J. Wysocki
2012-10-24 22:02         ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=32e5bed743cc6cc4e614291a7080299f5f0d0933.1350677395.git.viresh.kumar@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=arvind.chauhan@arm.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=linaro-dev@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=pdsw-power-team@arm.com \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.