Skip to content

Commit a7550ff

Browse files
covanamdtor
authored andcommitted
Input: 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. Acked-by: Zack Rusin <zack.rusin@broadcom.com> Signed-off-by: Nam Cao <namcao@linutronix.de> Link: https://lore.kernel.org/r/62db561622799dfc8d58682ca41b54e3f1ff6949.1738746904.git.namcao@linutronix.de Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent ab49769 commit a7550ff

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

drivers/input/joystick/walkera0701.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,7 @@ static void walkera0701_attach(struct parport *pp)
232232
goto err_unregister_device;
233233
}
234234

235-
hrtimer_init(&w->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
236-
w->timer.function = timer_handler;
235+
hrtimer_setup(&w->timer, timer_handler, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
237236

238237
w->input_dev = input_allocate_device();
239238
if (!w->input_dev) {

drivers/input/keyboard/gpio_keys.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
590590

591591
INIT_DELAYED_WORK(&bdata->work, gpio_keys_gpio_work_func);
592592

593-
hrtimer_init(&bdata->debounce_timer,
594-
CLOCK_REALTIME, HRTIMER_MODE_REL);
595-
bdata->debounce_timer.function = gpio_keys_debounce_timer;
593+
hrtimer_setup(&bdata->debounce_timer, gpio_keys_debounce_timer, CLOCK_REALTIME,
594+
HRTIMER_MODE_REL);
596595

597596
isr = gpio_keys_gpio_isr;
598597
irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING;
@@ -628,9 +627,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
628627
}
629628

630629
bdata->release_delay = button->debounce_interval;
631-
hrtimer_init(&bdata->release_timer,
632-
CLOCK_REALTIME, HRTIMER_MODE_REL_HARD);
633-
bdata->release_timer.function = gpio_keys_irq_timer;
630+
hrtimer_setup(&bdata->release_timer, gpio_keys_irq_timer, CLOCK_REALTIME,
631+
HRTIMER_MODE_REL_HARD);
634632

635633
isr = gpio_keys_irq_isr;
636634
irqflags = 0;

0 commit comments

Comments
 (0)