Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: 7560/1: SMP_TWD: use DIV_ROUND_CLOSEST() for periodic mode

The periodic mode is currently calculated by a simple division
but we should pay more attention to our integer arithmetics.
Also delete a comment that does not make any sense.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Linus Walleij and committed by
Russell King
ad17a26e 5f40b909

+2 -2
+2 -2
arch/arm/kernel/smp_twd.c
··· 42 42 43 43 switch (mode) { 44 44 case CLOCK_EVT_MODE_PERIODIC: 45 - /* timer load already set up */ 46 45 ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE 47 46 | TWD_TIMER_CONTROL_PERIODIC; 48 - __raw_writel(twd_timer_rate / HZ, twd_base + TWD_TIMER_LOAD); 47 + __raw_writel(DIV_ROUND_CLOSEST(twd_timer_rate, HZ), 48 + twd_base + TWD_TIMER_LOAD); 49 49 break; 50 50 case CLOCK_EVT_MODE_ONESHOT: 51 51 /* period set, and timer enabled in 'next_event' hook */