diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2012-03-26 16:51:26 +0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2012-03-30 09:55:04 +0400 |
commit | fc850f39ea54c760ce438a601cfea8ab80c4898e (patch) | |
tree | 3f413ea8c13cc12f7f6af16bc198a17914695f1b /drivers | |
parent | 3a53396b0381ec9d5180fd8fe7a681c8ce95fd9a (diff) | |
download | linux-fc850f39ea54c760ce438a601cfea8ab80c4898e.tar.xz |
cpuidle: use the driver's state_count as default
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/cpuidle/cpuidle.c | 2 | ||||
-rw-r--r-- | drivers/cpuidle/driver.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 77304b6b8aef..f7cab5e9c4d6 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -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); diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c index 284d7af5a9c8..40cd3f3024df 100644 --- a/drivers/cpuidle/driver.c +++ b/drivers/cpuidle/driver.c @@ -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()) |