public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: sm501: Use DIV_ROUND_CLOSEST
@ 2012-03-12  2:12 Axel Lin
  2012-03-16 19:38 ` Samuel Ortiz
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2012-03-12  2:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ben Dooks, Samuel Ortiz

Use DIV_ROUND_CLOSEST to replace sm501fb_round_div function.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/mfd/sm501.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index f4d8611..d927dd4 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -387,14 +387,6 @@ int sm501_unit_power(struct device *dev, unsigned int unit, unsigned int to)
 
 EXPORT_SYMBOL_GPL(sm501_unit_power);
 
-
-/* Perform a rounded division. */
-static long sm501fb_round_div(long num, long denom)
-{
-        /* n / d + 1 / 2 = (2n + d) / 2d */
-        return (2 * num + denom) / (2 * denom);
-}
-
 /* clock value structure. */
 struct sm501_clock {
 	unsigned long mclk;
@@ -428,7 +420,7 @@ static int sm501_calc_clock(unsigned long freq,
 		/* try all 8 shift values.*/
 		for (shift = 0; shift < 8; shift++) {
 			/* Calculate difference to requested clock */
-			diff = sm501fb_round_div(mclk, divider << shift) - freq;
+			diff = DIV_ROUND_CLOSEST(mclk, divider << shift) - freq;
 			if (diff < 0)
 				diff = -diff;
 
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mfd: sm501: Use DIV_ROUND_CLOSEST
  2012-03-12  2:12 [PATCH] mfd: sm501: Use DIV_ROUND_CLOSEST Axel Lin
@ 2012-03-16 19:38 ` Samuel Ortiz
  0 siblings, 0 replies; 2+ messages in thread
From: Samuel Ortiz @ 2012-03-16 19:38 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Ben Dooks

Hi Axel,

On Mon, Mar 12, 2012 at 10:12:34AM +0800, Axel Lin wrote:
> Use DIV_ROUND_CLOSEST to replace sm501fb_round_div function.
Patch applied, thanks.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-16 19:30 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:12 [PATCH] mfd: sm501: Use DIV_ROUND_CLOSEST Axel Lin
2012-03-16 19:38 ` Samuel Ortiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox