clockevents: Use helpers to check the state of a clockevent device
[cascardo/linux.git] / kernel / time / tick-common.c
index 3ae6afa..cf881c6 100644 (file)
@@ -102,7 +102,17 @@ void tick_handle_periodic(struct clock_event_device *dev)
 
        tick_periodic(cpu);
 
-       if (dev->state != CLOCK_EVT_STATE_ONESHOT)
+#if defined(CONFIG_HIGH_RES_TIMERS) || defined(CONFIG_NO_HZ_COMMON)
+       /*
+        * The cpu might have transitioned to HIGHRES or NOHZ mode via
+        * update_process_times() -> run_local_timers() ->
+        * hrtimer_run_queues().
+        */
+       if (dev->event_handler != tick_handle_periodic)
+               return;
+#endif
+
+       if (!clockevent_state_oneshot(dev))
                return;
        for (;;) {
                /*