Skip to content

Commit

Permalink
regulator: Fix return code from regulator_disable_deferred()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mark Brown committed Oct 4, 2011
1 parent 38f3f31 commit aa59802
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit aa59802

Please sign in to comment.