Skip to content

Commit

Permalink
regulator: Ensure enough delay time for enabling regulator
Browse files Browse the repository at this point in the history
Integer division will truncate the result, this patch ensures we have
enough delay time for enabling regulator.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
  • Loading branch information
Axel Lin authored and Liam Girdwood committed Nov 30, 2010
1 parent aa7a740 commit e36c1df
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1312,10 +1312,12 @@ static int _regulator_enable(struct regulator_dev *rdev)
if (ret < 0)
return ret;

if (delay >= 1000)
if (delay >= 1000) {
mdelay(delay / 1000);
else if (delay)
udelay(delay % 1000);
} else if (delay) {
udelay(delay);
}

} else if (ret < 0) {
printk(KERN_ERR "%s: is_enabled() failed for %s: %d\n",
Expand Down

0 comments on commit e36c1df

Please sign in to comment.