linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: rjw@sisk.pl, lenb@kernel.org
Cc: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org,
	patches@linaro.org, linaro-dev@lists.linaro.org
Subject: [PATCH 2/3] cpuidle : rename function name "__cpuidle_register_driver"
Date: Wed, 19 Sep 2012 19:22:48 +0200	[thread overview]
Message-ID: <1348075369-16451-2-git-send-email-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <1348075369-16451-1-git-send-email-daniel.lezcano@linaro.org>

Clarify the purpose of the function by changing its name and
move the condition out of this function.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/cpuidle/driver.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 40cd3f3..774d2cb 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -17,9 +17,10 @@
 static struct cpuidle_driver *cpuidle_curr_driver;
 DEFINE_SPINLOCK(cpuidle_driver_lock);
 
-static void __cpuidle_register_driver(struct cpuidle_driver *drv)
+static void set_power_states(struct cpuidle_driver *drv)
 {
 	int i;
+
 	/*
 	 * cpuidle driver should set the drv->power_specified bit
 	 * before registering if the driver provides
@@ -34,10 +35,8 @@ static void __cpuidle_register_driver(struct cpuidle_driver *drv)
 	 * an power value of -1.  So we use -2, -3, etc, for other
 	 * c-states.
 	 */
-	if (!drv->power_specified) {
-		for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++)
-			drv->states[i].power_usage = -1 - i;
-	}
+	for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++)
+		drv->states[i].power_usage = -1 - i;
 }
 
 
@@ -58,8 +57,10 @@ int cpuidle_register_driver(struct cpuidle_driver *drv)
 		spin_unlock(&cpuidle_driver_lock);
 		return -EBUSY;
 	}
-	__cpuidle_register_driver(drv);
-	cpuidle_curr_driver = drv;
+
+	if (!drv->power_specified)
+		set_power_states(drv);
+
 	spin_unlock(&cpuidle_driver_lock);
 
 	return 0;
-- 
1.7.5.4


  reply	other threads:[~2012-09-19 17:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-19 17:22 [PATCH 1/3] cpuidle : remove unused ref count function Daniel Lezcano
2012-09-19 17:22 ` Daniel Lezcano [this message]
2012-09-19 19:51   ` [PATCH 2/3] cpuidle : rename function name "__cpuidle_register_driver" Rafael J. Wysocki
2012-09-19 20:00     ` Daniel Lezcano
2012-09-19 17:22 ` [PATCH 3/3] cpuidle : remove trailing carriage return Daniel Lezcano
2012-09-19 20:16   ` Rafael J. Wysocki
2012-09-19 19:49 ` [PATCH 1/3] cpuidle : remove unused ref count function Rafael J. Wysocki
2012-09-19 19:56   ` Daniel Lezcano

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=1348075369-16451-2-git-send-email-daniel.lezcano@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=lenb@kernel.org \
    --cc=linaro-dev@lists.linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=patches@linaro.org \
    --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 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).