Skip to contentSkip to conversation

regulator: Ensure enough delay time for enabling regulator

PATCH In review Axel Lin 3 participants 3 messages Nov 5, 2010 – Nov 6, 2010 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH v2 2/3 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.

---
 drivers/regulator/core.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/regulator/core.c +4 -2
index 5ee67ba..0ab5749 100644
@@ -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",
Signature · 1 line
1.7.0.4
#2 lore raw
Quoted 7 lines · Mark Brown
Quoted 4 lines · Axel Lin

Integer division will truncate the result, this patch ensures we have enough delay time for enabling regulator.

All applied.

Thanks

Liam

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk