diff mbox

[5/5] cpuidle / ACPI : pass the cpuidle driver as parameter

Message ID 1350640292-22468-5-git-send-email-daniel.lezcano@linaro.org (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Daniel Lezcano Oct. 19, 2012, 9:51 a.m. UTC
Instead of refering to a global variable in the function, let's pass
the cpuidle_driver as a parameter to this function.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/acpi/processor_idle.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index f87cb2e..da38a4b 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1030,12 +1030,12 @@  static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,
  *
  * @pr: the ACPI processor
  */
-static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
+static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr,
+					       struct cpuidle_driver *drv)
 {
 	int i, count = CPUIDLE_DRIVER_STATE_START;
 	struct acpi_processor_cx *cx;
 	struct cpuidle_state *state;
-	struct cpuidle_driver *drv = &acpi_idle_driver;
 
 	if (!pr->flags.power_setup_done)
 		return -EINVAL;
@@ -1146,6 +1146,7 @@  int acpi_processor_cst_has_changed(struct acpi_processor *pr)
 	int cpu;
 	struct acpi_processor *_pr;
 	struct cpuidle_device *dev;
+	struct cpuidle_driver *drv = cpuidle_get_driver();
 
 	if (disabled_by_idle_boot_param())
 		return 0;
@@ -1164,7 +1165,7 @@  int acpi_processor_cst_has_changed(struct acpi_processor *pr)
 	 * system instead of once per-cpu.  This condition is a hack
 	 * to make the code that updates C-States be called once.
 	 */
-	if (pr->id != 0 || cpuidle_get_driver() != &acpi_idle_driver)
+	if (pr->id != 0 || drv != &acpi_idle_driver)
 		return 0;
 
 	cpuidle_pause_and_lock();
@@ -1181,7 +1182,7 @@  int acpi_processor_cst_has_changed(struct acpi_processor *pr)
 	}
 
 	/* Populate Updated C-state information */
-	acpi_processor_setup_cpuidle_states(pr);
+	acpi_processor_setup_cpuidle_states(pr, drv);
 
 	/* Enable all cpuidle devices */
 	for_each_online_cpu(cpu) {
@@ -1250,7 +1251,7 @@  int __cpuinit acpi_processor_power_init(struct acpi_processor *pr)
 
 	/* Register acpi_idle_driver if not already registered */
 	if (!acpi_processor_registered) {
-		acpi_processor_setup_cpuidle_states(pr);
+		acpi_processor_setup_cpuidle_states(pr, &acpi_idle_driver);
 		retval = cpuidle_register_driver(&acpi_idle_driver);
 		if (retval)
 			return retval;