]> git.karo-electronics.de Git - linux-beck.git/commitdiff
regulator: Ensure enough enable time for max8649
authorAxel Lin <axel.lin@gmail.com>
Tue, 2 Aug 2011 04:54:56 +0000 (12:54 +0800)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Mon, 8 Aug 2011 16:15:08 +0000 (17:15 +0100)
Integer division may truncate the result, thus max8649_enable_time() may return
slightly shorter enable time. This patch fixes it.

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>
drivers/regulator/max8649.c

index 30eb9e54f7ec033a8ae7d889a5e42599c47a0a7c..1062cf9f02dc3303a7fae53a23203dd21a7707a8 100644 (file)
@@ -221,7 +221,7 @@ static int max8649_enable_time(struct regulator_dev *rdev)
        ret = (ret & MAX8649_RAMP_MASK) >> 5;
        rate = (32 * 1000) >> ret;      /* uV/uS */
 
-       return (voltage / rate);
+       return DIV_ROUND_UP(voltage, rate);
 }
 
 static int max8649_set_mode(struct regulator_dev *rdev, unsigned int mode)