summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2012-10-18 11:12:31 +0200
committerLinus Walleij <linus.walleij@linaro.org>2012-11-05 09:55:32 +0100
commit2136683172f49a32b3ed7469f6e5ce20c8f4278b (patch)
tree3bfa057454f38388acfedb9e2144e8e5f07da3f6
parent0813069d03f312b48b836f20e7f12073288f0f82 (diff)
downloadop-kernel-dev-2136683172f49a32b3ed7469f6e5ce20c8f4278b.zip
op-kernel-dev-2136683172f49a32b3ed7469f6e5ce20c8f4278b.tar.gz
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 <rubini@unipv.it> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--arch/arm/plat-nomadik/timer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/arm/plat-nomadik/timer.c b/arch/arm/plat-nomadik/timer.c
index 0ae2b06..f911430 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 */
OpenPOWER on IntegriCloud