Skip to content

Commit

Permalink
regulator: Use DIV_ROUND_CLOSEST in wm8350_isink_get_current
Browse files Browse the repository at this point in the history
DIV_ROUND_CLOSEST performs the computation (x + d/2)/d with better readability.

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 12, 2012
1 parent 85c5d86 commit dce7304
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/regulator/wm8350-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ static int wm8350_isink_get_current(struct regulator_dev *rdev)
return 0;
}

return (isink_cur[val] + 50) / 100;
return DIV_ROUND_CLOSEST(isink_cur[val], 100);
}

/* turn on ISINK followed by DCDC */
Expand Down

0 comments on commit dce7304

Please sign in to comment.