Skip to content

Commit

Permalink
treewide: Convert new and leftover hrtimer_init() users
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Apr 5, 2025
1 parent 8fa7292 commit 48ad7bb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
3 changes: 1 addition & 2 deletions drivers/input/joystick/walkera0701.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ static void walkera0701_attach(struct parport *pp)
goto err_unregister_device;
}

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

w->input_dev = input_allocate_device();
if (!w->input_dev) {
Expand Down
10 changes: 4 additions & 6 deletions drivers/input/keyboard/gpio_keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,

INIT_DELAYED_WORK(&bdata->work, gpio_keys_gpio_work_func);

hrtimer_init(&bdata->debounce_timer,
CLOCK_REALTIME, HRTIMER_MODE_REL);
bdata->debounce_timer.function = gpio_keys_debounce_timer;
hrtimer_setup(&bdata->debounce_timer, gpio_keys_debounce_timer,
CLOCK_REALTIME, HRTIMER_MODE_REL);

isr = gpio_keys_gpio_isr;
irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING;
Expand Down Expand Up @@ -628,9 +627,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
}

bdata->release_delay = button->debounce_interval;
hrtimer_init(&bdata->release_timer,
CLOCK_REALTIME, HRTIMER_MODE_REL_HARD);
bdata->release_timer.function = gpio_keys_irq_timer;
hrtimer_setup(&bdata->release_timer, gpio_keys_irq_timer,
CLOCK_REALTIME, HRTIMER_MODE_REL_HARD);

isr = gpio_keys_irq_isr;
irqflags = 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/netdevsim/netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ static enum hrtimer_restart nsim_napi_schedule(struct hrtimer *timer)

static void nsim_rq_timer_init(struct nsim_rq *rq)
{
hrtimer_init(&rq->napi_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
rq->napi_timer.function = nsim_napi_schedule;
hrtimer_setup(&rq->napi_timer, nsim_napi_schedule, CLOCK_MONOTONIC,
HRTIMER_MODE_REL);
}

static void nsim_enable_napi(struct netdevsim *ns)
Expand Down
4 changes: 2 additions & 2 deletions drivers/pps/generators/pps_gen_tio.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ static int pps_gen_tio_probe(struct platform_device *pdev)
return PTR_ERR(tio->base);

pps_tio_disable(tio);
hrtimer_init(&tio->timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
tio->timer.function = hrtimer_callback;
hrtimer_setup(&tio->timer, hrtimer_callback, CLOCK_REALTIME,
HRTIMER_MODE_ABS);
spin_lock_init(&tio->lock);
platform_set_drvdata(pdev, &tio);

Expand Down

0 comments on commit 48ad7bb

Please sign in to comment.