diff mbox

clocksource: sh_cmt: One-off clockevent fix

Message ID 20100802092930.30883.59203.sendpatchset@t400s (mailing list archive)
State Superseded
Headers show

Commit Message

Magnus Damm Aug. 2, 2010, 9:29 a.m. UTC
None
diff mbox

Patch

--- 0006/drivers/clocksource/sh_cmt.c
+++ work/drivers/clocksource/sh_cmt.c	2010-08-02 17:43:08.000000000 +0900
@@ -478,7 +478,7 @@  static void sh_cmt_clock_event_start(str
 	ced->min_delta_ns = clockevent_delta2ns(0x1f, ced);
 
 	if (periodic)
-		sh_cmt_set_next(p, (p->rate + HZ/2) / HZ);
+		sh_cmt_set_next(p, ((p->rate + HZ/2) / HZ) - 1);
 	else
 		sh_cmt_set_next(p, p->max_match_value);
 }
@@ -523,9 +523,9 @@  static int sh_cmt_clock_event_next(unsig
 
 	BUG_ON(ced->mode != CLOCK_EVT_MODE_ONESHOT);
 	if (likely(p->flags & FLAG_IRQCONTEXT))
-		p->next_match_value = delta;
+		p->next_match_value = delta - 1;
 	else
-		sh_cmt_set_next(p, delta);
+		sh_cmt_set_next(p, delta - 1);
 
 	return 0;
 }