summaryrefslogtreecommitdiff
path: root/drivers/pwm/pwm-omap-dmtimer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pwm/pwm-omap-dmtimer.c')
-rw-r--r--drivers/pwm/pwm-omap-dmtimer.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c
index 54641e45f45b..e0679eb399f6 100644
--- a/drivers/pwm/pwm-omap-dmtimer.c
+++ b/drivers/pwm/pwm-omap-dmtimer.c
@@ -49,11 +49,7 @@ to_pwm_omap_dmtimer_chip(struct pwm_chip *chip)
static u32 pwm_omap_dmtimer_get_clock_cycles(unsigned long clk_rate, int ns)
{
- u64 c = (u64)clk_rate * ns;
-
- do_div(c, NSEC_PER_SEC);
-
- return c;
+ return DIV_ROUND_CLOSEST_ULL((u64)clk_rate * ns, NSEC_PER_SEC);
}
static void pwm_omap_dmtimer_start(struct pwm_omap_dmtimer_chip *omap)