diff options
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) | |||
387 | 387 | ||
388 | EXPORT_SYMBOL_GPL(sm501_unit_power); | 388 | EXPORT_SYMBOL_GPL(sm501_unit_power); |
389 | 389 | ||
390 | |||
391 | /* Perform a rounded division. */ | ||
392 | static long sm501fb_round_div(long num, long denom) | ||
393 | { | ||
394 | /* n / d + 1 / 2 = (2n + d) / 2d */ | ||
395 | return (2 * num + denom) / (2 * denom); | ||
396 | } | ||
397 | |||
398 | /* clock value structure. */ | 390 | /* clock value structure. */ |
399 | struct sm501_clock { | 391 | struct sm501_clock { |
400 | unsigned long mclk; | 392 | unsigned long mclk; |
@@ -428,7 +420,7 @@ static int sm501_calc_clock(unsigned long freq, | |||
428 | /* try all 8 shift values.*/ | 420 | /* try all 8 shift values.*/ |
429 | for (shift = 0; shift < 8; shift++) { | 421 | for (shift = 0; shift < 8; shift++) { |
430 | /* Calculate difference to requested clock */ | 422 | /* Calculate difference to requested clock */ |
431 | diff = sm501fb_round_div(mclk, divider << shift) - freq; | 423 | diff = DIV_ROUND_CLOSEST(mclk, divider << shift) - freq; |
432 | if (diff < 0) | 424 | if (diff < 0) |
433 | diff = -diff; | 425 | diff = -diff; |
434 | 426 | ||