From: Linus Walleij Date: Thu, 18 Oct 2012 09:12:31 +0000 (+0200) Subject: ARM: plat-nomadik: use DIV_ROUND_CLOSEST() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2136683172f49a32b3ed7469f6e5ce20c8f4278b;p=linux-beck.git ARM: plat-nomadik: use DIV_ROUND_CLOSEST() Use DIV_ROUND_CLOSEST() to calculate the cycle counter for the periodic mode instead of relying on homebrew reimplementation. Cc: Alessandro Rubini Acked-by: Arnd Bergmann Signed-off-by: Linus Walleij --- diff --git a/arch/arm/plat-nomadik/timer.c b/arch/arm/plat-nomadik/timer.c index 0ae2b068ee0f..f9114306657b 100644 --- a/arch/arm/plat-nomadik/timer.c +++ b/arch/arm/plat-nomadik/timer.c @@ -201,7 +201,8 @@ void __init nmdk_timer_init(void __iomem *base, int irq) clk_prescale = MTU_CRn_PRESCALE_1; } - nmdk_cycle = (rate + HZ/2) / HZ; + /* Cycles for periodic mode */ + nmdk_cycle = DIV_ROUND_CLOSEST(rate, HZ); /* Timer 0 is the free running clocksource */