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@xxxxxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html