Skip to content

Commit

Permalink
regulator: max1586: Use DIV_ROUND_UP macro to calculate selector
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Axel Lin authored and Mark Brown committed Mar 11, 2012
1 parent 8148ed6 commit 7d530d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/regulator/max1586.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 7d530d3

Please sign in to comment.