summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-11-05 16:51:32 +0300
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-11-30 18:13:25 +0300
commite36c1df8e18183ba2c691fe766a52c94020cdc5e (patch)
tree59196f9c9d1dbd1dcfc6aeef73f5dd84b35ceb15 /drivers/regulator
parentaa7a74040a989eeb7a9265550a2538863e842a93 (diff)
downloadlinux-e36c1df8e18183ba2c691fe766a52c94020cdc5e.tar.xz
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>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index c3f93b401e90..9da85bc21db4 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -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",