regulator: Ensure enough delay time for enabling regulator

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>
This commit is contained in:
Axel Lin 2010-11-05 21:51:32 +08:00 committed by Liam Girdwood
parent aa7a74040a
commit e36c1df8e1
1 changed files with 4 additions and 2 deletions

View File

@ -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",