Skip to contentSkip to conversation

regulator: Fix return code from regulator_disable_deferred()

PATCH New Mark Brown 1 participant 1 message Oct 3, 2011 Voltage and current regulator framework

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 regulator: Fix return code from regulator_disable_deferred()

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.

---

I'll queue this up along with the addition of the call in ASoC - please say if this is a problem.

 drivers/regulator/core.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/regulator/core.c +7 -2
index b39ec9f..0c6d301 100644
@@ -1600,13 +1600,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);
 
Signature · 1 line
1.7.6.3