Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Daniel Lezcano and committed by
Len Brown
fc850f39 3a53396b

+2 -2
+1 -1
drivers/cpuidle/cpuidle.c
··· 268 268 if (!drv || !cpuidle_curr_governor) 269 269 return -EIO; 270 270 if (!dev->state_count) 271 - return -EINVAL; 271 + dev->state_count = drv->state_count; 272 272 273 273 if (dev->registered == 0) { 274 274 ret = __cpuidle_register_device(dev);
+1 -1
drivers/cpuidle/driver.c
··· 47 47 */ 48 48 int cpuidle_register_driver(struct cpuidle_driver *drv) 49 49 { 50 - if (!drv) 50 + if (!drv || !drv->state_count) 51 51 return -EINVAL; 52 52 53 53 if (cpuidle_disabled())