Skip to contentSkip to conversation

regulator: Use DIV_ROUND_CLOSEST in wm8350_isink_get_current

PATCH Applied Axel Lin 2 participants 2 messages Mar 12, 2012

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: Use DIV_ROUND_CLOSEST in wm8350_isink_get_current

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

---
 drivers/regulator/wm8350-regulator.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/wm8350-regulator.c +1 -1
index 4f46067..ab1e183 100644
@@ -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 */
Signature · 1 line
1.7.5.4
Applied
#1 lore raw
Quoted 1 line · Axel Lin

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

Applied, thanks.