On 09/19/2012 09:51 PM, Rafael J. Wysocki wrote: > On Wednesday, September 19, 2012, Daniel Lezcano wrote: >> Clarify the purpose of the function by changing its name and >> move the condition out of this function. > Why exactly are you removing the condition? I just moved the condition out from the function and called it when the condition is true. if (!drv->power_specified) set_power_states(drv); But please, drop this patch too. I noticed there is an overlap with the next patch I have in my series but not published. Accidentally I removed "cpuidle_curr_driver = drv;" Sorry for the inconvenience. Time for me to go to bed :) >> 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; >> > > _______________________________________________ > linaro-dev mailing list > linaro-dev@xxxxxxxxxxxxxxxx > http://lists.linaro.org/mailman/listinfo/linaro-dev > -- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog -- 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