public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3 v2] regulator: Ensure enough delay time for enabling regulator
@ 2010-11-05 13:51 Axel Lin
  2010-11-05 13:59 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2010-11-05 13:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown

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




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/3 v2] regulator: Ensure enough delay time for enabling regulator
  2010-11-05 13:51 [PATCH 2/3 v2] regulator: Ensure enough delay time for enabling regulator Axel Lin
@ 2010-11-05 13:59 ` Mark Brown
  2010-11-06 11:55   ` Liam Girdwood
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2010-11-05 13:59 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Liam Girdwood

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 <axel.lin@gmail.com>

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/3 v2] regulator: Ensure enough delay time for enabling regulator
  2010-11-05 13:59 ` Mark Brown
@ 2010-11-06 11:55   ` Liam Girdwood
  0 siblings, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2010-11-06 11:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Axel Lin, linux-kernel

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 <axel.lin@gmail.com>
> 
> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

All applied.

Thanks

Liam
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-06 11:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-05 13:51 [PATCH 2/3 v2] regulator: Ensure enough delay time for enabling regulator Axel Lin
2010-11-05 13:59 ` Mark Brown
2010-11-06 11:55   ` Liam Girdwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox