DORMANTno replies

[PATCH 3/8] ARM: plat-nomadik: use DIV_ROUND_CLOSEST()

From: Linus Walleij <hidden>
Date: 2012-10-18 17:18:52
Subsystem: arm port, the rest · Maintainers: Russell King, Linus Torvalds

From: Linus Walleij <redacted>

Use DIV_ROUND_CLOSEST() to calculate the cycle counter for the
periodic mode instead of relying on homebrew reimplementation.

Cc: Alessandro Rubini <redacted>
Signed-off-by: Linus Walleij <redacted>
---
 arch/arm/plat-nomadik/timer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
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 */
-- 
1.7.11.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help