summaryrefslogtreecommitdiff
path: root/drivers/cpuidle
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2013-06-12 15:08:55 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-07-15 02:09:48 +0200
commitc878a52d3c7cabab5b24460825c24eafd8be7058 (patch)
tree98c5e7c8599b62deac5559dc08fef9174173a39e /drivers/cpuidle
parent5df0aa7341bd94ca2023a60c64c63faeb6ec209d (diff)
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')
-rw-r--r--drivers/cpuidle/cpuidle.c5
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;