aboutsummaryrefslogtreecommitdiff
path: root/drivers/regulator/s5m8767.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-05-12 11:10:25 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-05-12 11:10:25 +0100
commit5949a7e9ab2db04edaeee7c368eb4c99131f4629 (patch)
tree13e8da5dc42cc62b9721659c41045d2c27c31cc3 /drivers/regulator/s5m8767.c
parent178e43aef2979525d7864daefd9499614e13800e (diff)
parent411a2df5090ccb88f4c3726e4951ebed579fec11 (diff)
Merge remote-tracking branch 'regulator/topic/drivers' into regulator-next
Conflicts: drivers/regulator/88pm8607.c (simple overlap with a bugfix in v3.4)
Diffstat (limited to 'drivers/regulator/s5m8767.c')
-rw-r--r--drivers/regulator/s5m8767.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index cb53187a60d..cf12e635154 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -12,7 +12,6 @@
*/
#include <linux/bug.h>
-#include <linux/delay.h>
#include <linux/err.h>
#include <linux/gpio.h>
#include <linux/slab.h>
@@ -347,7 +346,10 @@ static int s5m8767_convert_voltage_to_sel(
if (max_vol < desc->min || min_vol > desc->max)
return -EINVAL;
- selector = (min_vol - desc->min) / desc->step;
+ if (min_vol < desc->min)
+ min_vol = desc->min;
+
+ selector = DIV_ROUND_UP(min_vol - desc->min, desc->step);
if (desc->min + desc->step * selector > max_vol)
return -EINVAL;