regulator: Fix return code from regulator_disable_deferred()
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 3 Oct 2011 21:42:43 +0000 (22:42 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 4 Oct 2011 15:50:16 +0000 (16:50 +0100)
schedule_delayed_work() returns a bool indicating if the work was already
queued when it succeeds so we need to squash a true down to zero.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/core.c

index d0bde70f346650993d3d95b60d1ccf5136c27913..9e4c123c402820ce13dabb33f065381a74cba45f 100644 (file)
@@ -1599,13 +1599,18 @@ static void regulator_disable_work(struct work_struct *work)
 int regulator_disable_deferred(struct regulator *regulator, int ms)
 {
        struct regulator_dev *rdev = regulator->rdev;
+       int ret;
 
        mutex_lock(&rdev->mutex);
        rdev->deferred_disables++;
        mutex_unlock(&rdev->mutex);
 
-       return schedule_delayed_work(&rdev->disable_work,
-                                    msecs_to_jiffies(ms));
+       ret = schedule_delayed_work(&rdev->disable_work,
+                                   msecs_to_jiffies(ms));
+       if (ret < 0)
+               return ret;
+       else
+               return 0;
 }
 EXPORT_SYMBOL_GPL(regulator_disable_deferred);