[PATCH v2 22/31] ubifs: Switch to use hrtimer_setup()

Nam Cao posted 31 patches 10 months, 1 week ago
[PATCH v2 22/31] ubifs: Switch to use hrtimer_setup()
Posted by Nam Cao 10 months, 1 week ago
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.

Patch was created by using Coccinelle.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Richard Weinberger <richard@nod.at>
---
 fs/ubifs/io.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c
index 01d8eb170382..a79f229df475 100644
--- a/fs/ubifs/io.c
+++ b/fs/ubifs/io.c
@@ -1179,8 +1179,7 @@ int ubifs_wbuf_init(struct ubifs_info *c, struct ubifs_wbuf *wbuf)
 	wbuf->c = c;
 	wbuf->next_ino = 0;
 
-	hrtimer_init(&wbuf->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	wbuf->timer.function = wbuf_timer_callback_nolock;
+	hrtimer_setup(&wbuf->timer, wbuf_timer_callback_nolock, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	return 0;
 }
 
-- 
2.39.5
Re: [PATCH v2 22/31] ubifs: Switch to use hrtimer_setup()
Posted by Richard Weinberger 10 months, 1 week ago
----- Ursprüngliche Mail -----
> Von: "Nam Cao" <namcao@linutronix.de>
> An: "Anna-Maria Behnsen" <anna-maria@linutronix.de>, "frederic" <frederic@kernel.org>, "tglx" <tglx@linutronix.de>,
> "linux-kernel" <linux-kernel@vger.kernel.org>
> CC: "Nam Cao" <namcao@linutronix.de>, "richard" <richard@nod.at>
> Gesendet: Mittwoch, 5. Februar 2025 11:39:06
> Betreff: [PATCH v2 22/31] ubifs: Switch to use hrtimer_setup()

> 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.
> 
> Patch was created by using Coccinelle.
> 
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> Cc: Richard Weinberger <richard@nod.at>
> ---
> fs/ubifs/io.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c
> index 01d8eb170382..a79f229df475 100644
> --- a/fs/ubifs/io.c
> +++ b/fs/ubifs/io.c
> @@ -1179,8 +1179,7 @@ int ubifs_wbuf_init(struct ubifs_info *c, struct
> ubifs_wbuf *wbuf)
> 	wbuf->c = c;
> 	wbuf->next_ino = 0;
> 
> -	hrtimer_init(&wbuf->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> -	wbuf->timer.function = wbuf_timer_callback_nolock;
> +	hrtimer_setup(&wbuf->timer, wbuf_timer_callback_nolock, CLOCK_MONOTONIC,
> HRTIMER_MODE_REL);
> 	return 0;

Acked-by: Richard Weinberger <richard@nod.at>

Thanks,
//richard