]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
timerfd: Switch to use hrtimer_setup()
authorNam Cao <namcao@linutronix.de>
Wed, 5 Feb 2025 10:39:03 +0000 (11:39 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 18 Feb 2025 09:32:33 +0000 (10:32 +0100)
hrtimer_setup() takes the callback function pointer as argument and
initializes the timer completely.

Replace hrtimer_init() 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/2d1f26c2c2f3ad15f1ca1a09ecb9d760cafef4a6.1738746821.git.namcao@linutronix.de
fs/timerfd.c

index 9f7eb451a60f611aa156db6beb75de0004efbbfb..cee007e0d9780912c905eacfeb990f9d14c004a8 100644 (file)
@@ -205,9 +205,8 @@ static int timerfd_setup(struct timerfd_ctx *ctx, int flags,
                           ALARM_REALTIME : ALARM_BOOTTIME,
                           timerfd_alarmproc);
        } else {
-               hrtimer_init(&ctx->t.tmr, clockid, htmode);
+               hrtimer_setup(&ctx->t.tmr, timerfd_tmrproc, clockid, htmode);
                hrtimer_set_expires(&ctx->t.tmr, texp);
-               ctx->t.tmr.function = timerfd_tmrproc;
        }
 
        if (texp != 0) {
@@ -429,7 +428,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
                           ALARM_REALTIME : ALARM_BOOTTIME,
                           timerfd_alarmproc);
        else
-               hrtimer_init(&ctx->t.tmr, clockid, HRTIMER_MODE_ABS);
+               hrtimer_setup(&ctx->t.tmr, timerfd_tmrproc, clockid, HRTIMER_MODE_ABS);
 
        ctx->moffs = ktime_mono_to_real(0);