diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2013-06-12 15:08:55 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-15 02:09:48 +0200 |
commit | c878a52d3c7cabab5b24460825c24eafd8be7058 (patch) | |
tree | 98c5e7c8599b62deac5559dc08fef9174173a39e /drivers/cpuidle/cpuidle.c | |
parent | 5df0aa7341bd94ca2023a60c64c63faeb6ec209d (diff) | |
download | linux-c878a52d3c7cabab5b24460825c24eafd8be7058.tar.gz linux-c878a52d3c7cabab5b24460825c24eafd8be7058.tar.bz2 linux-c878a52d3c7cabab5b24460825c24eafd8be7058.zip |
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>
Diffstat (limited to 'drivers/cpuidle/cpuidle.c')
-rw-r--r-- | drivers/cpuidle/cpuidle.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 5b63185da59b..d75040ddd2b3 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -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; |