]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
cpuidle: use the driver's state_count as default
authorDaniel Lezcano <daniel.lezcano@linaro.org>
Mon, 26 Mar 2012 12:51:26 +0000 (14:51 +0200)
committerLen Brown <len.brown@intel.com>
Fri, 30 Mar 2012 05:55:04 +0000 (01:55 -0400)
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>
drivers/cpuidle/cpuidle.c
drivers/cpuidle/driver.c

index 77304b6b8aef29c2dfc20dd51af7effce492b923..f7cab5e9c4d6d894093ccb79e44a8227d0a7723e 100644 (file)
@@ -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);
index 284d7af5a9c827ab227293fafd52cd27db442864..40cd3f3024df4031f65a118a43e147e8e1b678bf 100644 (file)
@@ -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())