]> Git Repo - J-linux.git/commitdiff
alarmtimer: Switch to use hrtimer_setup() and hrtimer_setup_on_stack()
authorNam Cao <[email protected]>
Thu, 31 Oct 2024 15:14:32 +0000 (16:14 +0100)
committerThomas Gleixner <[email protected]>
Thu, 7 Nov 2024 01:47:07 +0000 (02:47 +0100)
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 <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Link: https://lore.kernel.org/all/2bae912336103405adcdab96b88d3ea0353b4228.1730386209.git.namcao@linutronix.de
kernel/time/alarmtimer.c

index 37d2d79daea49146a1e6cda517979c1ba78dfc39..0ddccdff119a0190f16d88c98d9aac4e037ad42d 100644 (file)
@@ -324,7 +324,6 @@ __alarm_init(struct alarm *alarm, enum alarmtimer_type type,
             void (*function)(struct alarm *, ktime_t))
 {
        timerqueue_init(&alarm->node);
-       alarm->timer.function = alarmtimer_fired;
        alarm->function = function;
        alarm->type = type;
        alarm->state = ALARMTIMER_STATE_INACTIVE;
@@ -339,8 +338,8 @@ __alarm_init(struct alarm *alarm, enum alarmtimer_type type,
 void alarm_init(struct alarm *alarm, enum alarmtimer_type type,
                void (*function)(struct alarm *, ktime_t))
 {
-       hrtimer_init(&alarm->timer, alarm_bases[type].base_clockid,
-                    HRTIMER_MODE_ABS);
+       hrtimer_setup(&alarm->timer, alarmtimer_fired, alarm_bases[type].base_clockid,
+                     HRTIMER_MODE_ABS);
        __alarm_init(alarm, type, function);
 }
 EXPORT_SYMBOL_GPL(alarm_init);
@@ -757,8 +756,8 @@ static void
 alarm_init_on_stack(struct alarm *alarm, enum alarmtimer_type type,
                    void (*function)(struct alarm *, ktime_t))
 {
-       hrtimer_init_on_stack(&alarm->timer, alarm_bases[type].base_clockid,
-                             HRTIMER_MODE_ABS);
+       hrtimer_setup_on_stack(&alarm->timer, alarmtimer_fired, alarm_bases[type].base_clockid,
+                              HRTIMER_MODE_ABS);
        __alarm_init(alarm, type, function);
 }
 
This page took 0.051633 seconds and 4 git commands to generate.