aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2012-10-29 10:24:18 -0400
committerJohn Stultz <john.stultz@linaro.org>2012-11-13 14:04:52 -0500
commit980097b36074596c76c1367a9e7b70ec8583d55b (patch)
tree361546a15dd634ff684a607707bfdc4f45605197 /drivers/clocksource
parentf95a985781e9e986992351c971af7f7e46e06ed5 (diff)
clocksource: arm_generic: use integer math helpers
This will make the two crucial integer divisions in the generic ARM arch timer used for ARMv8 use the kernel DIV_ROUND_CLOSEST() helper inline from <linux/kernel.h> so they get more precise. Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'drivers/clocksource')
-rw-r--r--drivers/clocksource/arm_generic.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/clocksource/arm_generic.c b/drivers/clocksource/arm_generic.c
index c4d9f9566c6..6cd1b30e01a 100644
--- a/drivers/clocksource/arm_generic.c
+++ b/drivers/clocksource/arm_generic.c
@@ -127,7 +127,7 @@ static void __init arch_timer_calibrate(void)
127 127
128 /* Cache the sched_clock multiplier to save a divide in the hot path. */ 128 /* Cache the sched_clock multiplier to save a divide in the hot path. */
129 129
130 sched_clock_mult = NSEC_PER_SEC / arch_timer_rate; 130 sched_clock_mult = DIV_ROUND_CLOSEST(NSEC_PER_SEC, arch_timer_rate);
131 131
132 pr_info("Architected local timer running at %u.%02uMHz.\n", 132 pr_info("Architected local timer running at %u.%02uMHz.\n",
133 arch_timer_rate / 1000000, (arch_timer_rate / 10000) % 100); 133 arch_timer_rate / 1000000, (arch_timer_rate / 10000) % 100);
@@ -221,7 +221,7 @@ int __init arm_generic_timer_init(void)
221 clocksource_register_hz(&clocksource_counter, arch_timer_rate); 221 clocksource_register_hz(&clocksource_counter, arch_timer_rate);
222 222
223 /* Calibrate the delay loop directly */ 223 /* Calibrate the delay loop directly */
224 lpj_fine = arch_timer_rate / HZ; 224 lpj_fine = DIV_ROUND_CLOSEST(arch_timer_rate, HZ);
225 225
226 /* Immediately configure the timer on the boot CPU */ 226 /* Immediately configure the timer on the boot CPU */
227 arch_timer_setup(per_cpu_ptr(&arch_timer_evt, smp_processor_id())); 227 arch_timer_setup(per_cpu_ptr(&arch_timer_evt, smp_processor_id()));