Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad17a26e authored by Linus Walleij's avatar Linus Walleij Committed by Russell King
Browse files

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: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 5f40b909
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -42,10 +42,10 @@ static void twd_set_mode(enum clock_event_mode mode,

	switch (mode) {
	case CLOCK_EVT_MODE_PERIODIC:
		/* timer load already set up */
		ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE
			| TWD_TIMER_CONTROL_PERIODIC;
		__raw_writel(twd_timer_rate / HZ, twd_base + TWD_TIMER_LOAD);
		__raw_writel(DIV_ROUND_CLOSEST(twd_timer_rate, HZ),
			twd_base + TWD_TIMER_LOAD);
		break;
	case CLOCK_EVT_MODE_ONESHOT:
		/* period set, and timer enabled in 'next_event' hook */