Skip to content

Commit

Permalink
ARM: plat-nomadik: use DIV_ROUND_CLOSEST()
Browse files Browse the repository at this point in the history
Use DIV_ROUND_CLOSEST() to calculate the cycle counter for the
periodic mode instead of relying on homebrew reimplementation.

Cc: Alessandro Rubini <rubini@unipv.it>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Linus Walleij committed Nov 5, 2012
1 parent 0813069 commit 2136683
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/arm/plat-nomadik/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 2136683

Please sign in to comment.