forked from luck/tmp_suning_uos_patched
cpuidle: Check if device is already registered
Make __cpuidle_register_device() check whether or not the device has been registered already and return -EBUSY immediately if that's the case. [rjw: Changelog] Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
5df0aa7341
commit
c878a52d3c
@ -400,13 +400,16 @@ static int __cpuidle_register_device(struct cpuidle_device *dev)
|
||||
*/
|
||||
int cpuidle_register_device(struct cpuidle_device *dev)
|
||||
{
|
||||
int ret;
|
||||
int ret = -EBUSY;
|
||||
|
||||
if (!dev)
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&cpuidle_lock);
|
||||
|
||||
if (dev->registered)
|
||||
goto out_unlock;
|
||||
|
||||
ret = __cpuidle_device_init(dev);
|
||||
if (ret)
|
||||
goto out_unlock;
|
||||
|
Loading…
Reference in New Issue
Block a user