Skip to content

Commit 48ad7bb

Browse files
KAGA-KOKOIngo Molnar
authored andcommitted
treewide: Convert new and leftover hrtimer_init() users
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. Coccinelle scripted cleanup. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 8fa7292 commit 48ad7bb

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
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,
594+
CLOCK_REALTIME, 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,
631+
CLOCK_REALTIME, HRTIMER_MODE_REL_HARD);
634632

635633
isr = gpio_keys_irq_isr;
636634
irqflags = 0;

drivers/net/netdevsim/netdev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,8 @@ static enum hrtimer_restart nsim_napi_schedule(struct hrtimer *timer)
441441

442442
static void nsim_rq_timer_init(struct nsim_rq *rq)
443443
{
444-
hrtimer_init(&rq->napi_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
445-
rq->napi_timer.function = nsim_napi_schedule;
444+
hrtimer_setup(&rq->napi_timer, nsim_napi_schedule, CLOCK_MONOTONIC,
445+
HRTIMER_MODE_REL);
446446
}
447447

448448
static void nsim_enable_napi(struct netdevsim *ns)

drivers/pps/generators/pps_gen_tio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ static int pps_gen_tio_probe(struct platform_device *pdev)
227227
return PTR_ERR(tio->base);
228228

229229
pps_tio_disable(tio);
230-
hrtimer_init(&tio->timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
231-
tio->timer.function = hrtimer_callback;
230+
hrtimer_setup(&tio->timer, hrtimer_callback, CLOCK_REALTIME,
231+
HRTIMER_MODE_ABS);
232232
spin_lock_init(&tio->lock);
233233
platform_set_drvdata(pdev, &tio);
234234

0 commit comments

Comments
 (0)