* [PATCH] regulator: Use DIV_ROUND_CLOSEST in wm8350_isink_get_current
@ 2012-03-12 2:17 Axel Lin
2012-03-12 10:50 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2012-03-12 2:17 UTC (permalink / raw)
To: linux-kernel; +Cc: Mark Brown, Liam Girdwood
DIV_ROUND_CLOSEST performs the computation (x + d/2)/d with better readability.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] regulator: Use DIV_ROUND_CLOSEST in wm8350_isink_get_current
2012-03-12 2:17 [PATCH] regulator: Use DIV_ROUND_CLOSEST in wm8350_isink_get_current Axel Lin
@ 2012-03-12 10:50 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-03-12 10:50 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Liam Girdwood
[-- Attachment #1: Type: text/plain, Size: 158 bytes --]
On Mon, Mar 12, 2012 at 10:17:56AM +0800, Axel Lin wrote:
> DIV_ROUND_CLOSEST performs the computation (x + d/2)/d with better readability.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-12 10:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-12 2:17 [PATCH] regulator: Use DIV_ROUND_CLOSEST in wm8350_isink_get_current Axel Lin
2012-03-12 10:50 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox