]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
io_uring: Switch to use hrtimer_setup_on_stack()
authorNam Cao <namcao@linutronix.de>
Thu, 31 Oct 2024 15:14:31 +0000 (16:14 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 7 Nov 2024 01:47:06 +0000 (02:47 +0100)
hrtimer_setup_on_stack() takes the callback function pointer as argument
and initializes the timer completely.

Replace hrtimer_init_on_stack() and the open coded initialization of
hrtimer::function with the new setup mechanism.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/f0d4ac32ec4050710a656cee8385fa4427be33aa.1730386209.git.namcao@linutronix.de
io_uring/io_uring.c

index feb61d68dca68e6f71461af9b7c293d05f7ecd7f..0842aa3f60e7a53e682bb61392b1ab23a9b275b0 100644 (file)
@@ -2435,13 +2435,14 @@ static int io_cqring_schedule_timeout(struct io_wait_queue *iowq,
 {
        ktime_t timeout;
 
-       hrtimer_init_on_stack(&iowq->t, clock_id, HRTIMER_MODE_ABS);
        if (iowq->min_timeout) {
                timeout = ktime_add_ns(iowq->min_timeout, start_time);
-               iowq->t.function = io_cqring_min_timer_wakeup;
+               hrtimer_setup_on_stack(&iowq->t, io_cqring_min_timer_wakeup, clock_id,
+                                      HRTIMER_MODE_ABS);
        } else {
                timeout = iowq->timeout;
-               iowq->t.function = io_cqring_timer_wakeup;
+               hrtimer_setup_on_stack(&iowq->t, io_cqring_timer_wakeup, clock_id,
+                                      HRTIMER_MODE_ABS);
        }
 
        hrtimer_set_expires_range_ns(&iowq->t, timeout, 0);