summaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-03-02 16:22:01 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-03-11 20:48:49 +0000
commit7d530d32b0b71f1735a73f5b03e22955a5460b7f (patch)
tree1c5b37b4f4cf8e7dc707cf2d23c6da7b50866032 /drivers/regulator
parent8148ed6e6618598729efa53d3a1f905379de801e (diff)
downloadlinux-7d530d32b0b71f1735a73f5b03e22955a5460b7f.tar.bz2
regulator: max1586: Use DIV_ROUND_UP macro to calculate selector
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/max1586.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c
index 40e7a4db2853..282d2ee0604e 100644
--- a/drivers/regulator/max1586.c
+++ b/drivers/regulator/max1586.c
@@ -76,8 +76,8 @@ static int max1586_v3_set(struct regulator_dev *rdev, int min_uV, int max_uV,
if (min_uV < max1586->min_uV)
min_uV = max1586->min_uV;
- *selector = ((min_uV - max1586->min_uV) * MAX1586_V3_MAX_VSEL +
- range_uV - 1) / range_uV;
+ *selector = DIV_ROUND_UP((min_uV - max1586->min_uV) *
+ MAX1586_V3_MAX_VSEL, range_uV);
if (max1586_v3_calc_voltage(max1586, *selector) > max_uV)
return -EINVAL;