From: Axel Lin Date: Mon, 12 Mar 2012 02:17:56 +0000 (+0800) Subject: regulator: Use DIV_ROUND_CLOSEST in wm8350_isink_get_current X-Git-Tag: v3.4-rc2~22^2~21^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dce7304f4b8ea9e12c1bd58747f16f579c4d7b2d;p=profile%2Fivi%2Fkernel-x86-ivi.git regulator: Use DIV_ROUND_CLOSEST in wm8350_isink_get_current DIV_ROUND_CLOSEST performs the computation (x + d/2)/d with better readability. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c index 4f46067..ab1e183 100644 --- a/drivers/regulator/wm8350-regulator.c +++ b/drivers/regulator/wm8350-regulator.c @@ -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 */