Clockevent devices switch to ONESHOT_STOPPED mode when they are no longer required, i.e. expires == KTIME_MAX. We have taken care of all the call sites (we were aware of), where clockevent device must be switched back to ONESHOT mode.
To make sure we haven't missed any corner case, do WARN() when we try to program next event while we are still configured in ONESHOT_STOPPED mode.
Signed-off-by: Viresh Kumar viresh.kumar@linaro.org --- kernel/time/clockevents.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 9348da1..d04da72 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -267,6 +267,9 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires, if (dev->mode == CLOCK_EVT_MODE_SHUTDOWN) return 0;
+ /* Must switch to ONESHOT mode before programming next event */ + WARN_ON_ONCE(dev->mode == CLOCK_EVT_MODE_ONESHOT_STOPPED); + /* Shortcut for clockevent devices that can deal with ktime. */ if (dev->features & CLOCK_EVT_FEAT_KTIME) return dev->set_next_ktime(expires, dev);