Skip to content

Commit 7205656

Browse files
committed
clockevents: enforce reprogram in oneshot setup
In tick_oneshot_setup we program the device to the given next_event, but we do not check the return value. We need to make sure that the device is programmed enforced so the interrupt handler engine starts working. Split out the reprogramming function from tick_program_event() and call it with the device, which was handed in to tick_setup_oneshot(). Set the force argument, so the devices is firing an interrupt. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent d4496b3 commit 7205656

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

kernel/time/tick-oneshot.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
#include "tick-internal.h"
2424

2525
/**
26-
* tick_program_event
26+
* tick_program_event internal worker function
2727
*/
28-
int tick_program_event(ktime_t expires, int force)
28+
static int __tick_program_event(struct clock_event_device *dev,
29+
ktime_t expires, int force)
2930
{
30-
struct clock_event_device *dev = __get_cpu_var(tick_cpu_device).evtdev;
3131
ktime_t now = ktime_get();
3232

3333
while (1) {
@@ -40,6 +40,16 @@ int tick_program_event(ktime_t expires, int force)
4040
}
4141
}
4242

43+
/**
44+
* tick_program_event
45+
*/
46+
int tick_program_event(ktime_t expires, int force)
47+
{
48+
struct clock_event_device *dev = __get_cpu_var(tick_cpu_device).evtdev;
49+
50+
return __tick_program_event(dev, expires, force);
51+
}
52+
4353
/**
4454
* tick_resume_onshot - resume oneshot mode
4555
*/
@@ -61,7 +71,7 @@ void tick_setup_oneshot(struct clock_event_device *newdev,
6171
{
6272
newdev->event_handler = handler;
6373
clockevents_set_mode(newdev, CLOCK_EVT_MODE_ONESHOT);
64-
clockevents_program_event(newdev, next_event, ktime_get());
74+
__tick_program_event(newdev, next_event, 1);
6575
}
6676

6777
/**

0 commit comments

Comments
 (0)