[PATCH] regulator: Use DIV_ROUND_CLOSEST in wm8350_isink_get_current

From: Axel Lin
Date: Sun Mar 11 2012 - 22:18:08 EST


DIV_ROUND_CLOSEST performs the computation (x + d/2)/d with better readability.

Signed-off-by: Axel Lin <axel.lin@xxxxxxxxx>
---
drivers/regulator/wm8350-regulator.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

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 */
--
1.7.5.4



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/