Integer division will truncate the result, this patch ensures we have
enough delay time for enabling regulator.
Signed-off-by: Axel Lin <[email protected]>
---
drivers/regulator/core.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5ee67ba..0ab5749 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",
--
1.7.0.4
On Fri, Nov 05, 2010 at 09:51:32PM +0800, Axel Lin wrote:
> Integer division will truncate the result, this patch ensures we have
> enough delay time for enabling regulator.
>
> Signed-off-by: Axel Lin <[email protected]>
Acked-by: Mark Brown <[email protected]>
On Fri, 2010-11-05 at 09:59 -0400, Mark Brown wrote:
> On Fri, Nov 05, 2010 at 09:51:32PM +0800, Axel Lin wrote:
> > Integer division will truncate the result, this patch ensures we have
> > enough delay time for enabling regulator.
> >
> > Signed-off-by: Axel Lin <[email protected]>
>
> Acked-by: Mark Brown <[email protected]>
All applied.
Thanks
Liam
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk