Skip to content

Commit

Permalink
cpuidle: use the driver's state_count as default
Browse files Browse the repository at this point in the history
If the state_count is not initialized for the device use
the driver's state count as the default. That will prevent
to add it manually in the cpuidle driver initialization
routine and will save us from duplicate line of code.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Daniel Lezcano authored and Len Brown committed Mar 30, 2012
1 parent 3a53396 commit fc850f3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/cpuidle/cpuidle.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
if (!drv || !cpuidle_curr_governor)
return -EIO;
if (!dev->state_count)
return -EINVAL;
dev->state_count = drv->state_count;

if (dev->registered == 0) {
ret = __cpuidle_register_device(dev);
Expand Down
2 changes: 1 addition & 1 deletion drivers/cpuidle/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static void __cpuidle_register_driver(struct cpuidle_driver *drv)
*/
int cpuidle_register_driver(struct cpuidle_driver *drv)
{
if (!drv)
if (!drv || !drv->state_count)
return -EINVAL;

if (cpuidle_disabled())
Expand Down

0 comments on commit fc850f3

Please sign in to comment.