diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-03-12 10:12:34 +0800 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-03-16 20:37:47 +0100 |
commit | 829ecbcb14edea378a1409203ef0d4a68bbf795a (patch) | |
tree | 2eba2d48ef84f54d5b6efe69f02d673b91ec0a29 /drivers/mfd/sm501.c | |
parent | 1b1247dd75aa5cf5fae54a3bec7280046e9c7957 (diff) | |
download | linux-829ecbcb14edea378a1409203ef0d4a68bbf795a.tar.gz linux-829ecbcb14edea378a1409203ef0d4a68bbf795a.tar.bz2 linux-829ecbcb14edea378a1409203ef0d4a68bbf795a.zip |
mfd: Use DIV_ROUND_CLOSEST for sm501 clock
Use DIV_ROUND_CLOSEST to replace sm501fb_round_div function.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/sm501.c')
-rw-r--r-- | 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 f4d86117f44a..d927dd49acb3 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; |