[tip: timers/cleanups] lib: test_objpool: Switch to use hrtimer_setup()

tip-bot2 for Nam Cao posted 1 patch 10 months ago
lib/test_objpool.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[tip: timers/cleanups] lib: test_objpool: Switch to use hrtimer_setup()
Posted by tip-bot2 for Nam Cao 10 months ago
The following commit has been merged into the timers/cleanups branch of tip:

Commit-ID:     b09dffdeb3691483fc8fbe58ff7787c964b56d5c
Gitweb:        https://git.kernel.org/tip/b09dffdeb3691483fc8fbe58ff7787c964b56d5c
Author:        Nam Cao <namcao@linutronix.de>
AuthorDate:    Wed, 05 Feb 2025 11:38:59 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 18 Feb 2025 10:32:32 +01:00

lib: test_objpool: 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>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/edc46fbf290b280ebe67bb0d21599c4c30716b68.1738746821.git.namcao@linutronix.de

---
 lib/test_objpool.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/test_objpool.c b/lib/test_objpool.c
index 896c013..8f68818 100644
--- a/lib/test_objpool.c
+++ b/lib/test_objpool.c
@@ -190,8 +190,7 @@ static int ot_init_hrtimer(struct ot_item *item, unsigned long hrtimer)
 		return -ENOENT;
 
 	item->hrtcycle = ktime_set(0, hrtimer * 1000000UL);
-	hrtimer_init(hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	hrt->function = ot_hrtimer_handler;
+	hrtimer_setup(hrt, ot_hrtimer_handler, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	return 0;
 }