Skip to content

Commit d82fadc

Browse files
covanamKAGA-KOKO
authored andcommitted
alarmtimer: Switch to use hrtimer_setup() and hrtimer_setup_on_stack()
hrtimer_setup() and hrtimer_setup_on_stack() take the callback function pointer as argument and initialize the timer completely. Replace the hrtimer_init*() variants and the open coded initialization of hrtimer::function with the new setup mechanism. Switch to use the new functions. Signed-off-by: Nam Cao <namcao@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/2bae912336103405adcdab96b88d3ea0353b4228.1730386209.git.namcao@linutronix.de
1 parent fc9f59d commit d82fadc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

kernel/time/alarmtimer.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ __alarm_init(struct alarm *alarm, enum alarmtimer_type type,
324324
void (*function)(struct alarm *, ktime_t))
325325
{
326326
timerqueue_init(&alarm->node);
327-
alarm->timer.function = alarmtimer_fired;
328327
alarm->function = function;
329328
alarm->type = type;
330329
alarm->state = ALARMTIMER_STATE_INACTIVE;
@@ -339,8 +338,8 @@ __alarm_init(struct alarm *alarm, enum alarmtimer_type type,
339338
void alarm_init(struct alarm *alarm, enum alarmtimer_type type,
340339
void (*function)(struct alarm *, ktime_t))
341340
{
342-
hrtimer_init(&alarm->timer, alarm_bases[type].base_clockid,
343-
HRTIMER_MODE_ABS);
341+
hrtimer_setup(&alarm->timer, alarmtimer_fired, alarm_bases[type].base_clockid,
342+
HRTIMER_MODE_ABS);
344343
__alarm_init(alarm, type, function);
345344
}
346345
EXPORT_SYMBOL_GPL(alarm_init);
@@ -757,8 +756,8 @@ static void
757756
alarm_init_on_stack(struct alarm *alarm, enum alarmtimer_type type,
758757
void (*function)(struct alarm *, ktime_t))
759758
{
760-
hrtimer_init_on_stack(&alarm->timer, alarm_bases[type].base_clockid,
761-
HRTIMER_MODE_ABS);
759+
hrtimer_setup_on_stack(&alarm->timer, alarmtimer_fired, alarm_bases[type].base_clockid,
760+
HRTIMER_MODE_ABS);
762761
__alarm_init(alarm, type, function);
763762
}
764763

0 commit comments

Comments
 (0)