2010-11-05 13:51:38

by Axel Lin

[permalink] [raw]
Subject: [PATCH 2/3 v2] 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 <[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



2010-11-05 13:59:50

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 2/3 v2] regulator: Ensure enough delay time for enabling regulator

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]>

2010-11-06 11:55:48

by Liam Girdwood

[permalink] [raw]
Subject: Re: [PATCH 2/3 v2] regulator: Ensure enough delay time for enabling regulator

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