Skip to content

Commit 0ebb5e7

Browse files
covanamKAGA-KOKO
authored andcommitted
media: 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 <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Hans Verkuil <[email protected]> Acked-by: Zack Rusin <[email protected]> Link: https://lore.kernel.org/all/c725ad8d0ecac3cf6bbc532af567e56d47a6b75c.1738746904.git.namcao@linutronix.de
1 parent 7f657ad commit 0ebb5e7

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

drivers/media/cec/core/cec-pin.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,9 +1346,8 @@ struct cec_adapter *cec_pin_allocate_adapter(const struct cec_pin_ops *pin_ops,
13461346
if (pin == NULL)
13471347
return ERR_PTR(-ENOMEM);
13481348
pin->ops = pin_ops;
1349-
hrtimer_init(&pin->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
13501349
atomic_set(&pin->work_pin_num_events, 0);
1351-
pin->timer.function = cec_pin_timer;
1350+
hrtimer_setup(&pin->timer, cec_pin_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
13521351
init_waitqueue_head(&pin->kthread_waitq);
13531352
pin->tx_custom_low_usecs = CEC_TIM_CUSTOM_DEFAULT;
13541353
pin->tx_custom_high_usecs = CEC_TIM_CUSTOM_DEFAULT;

drivers/media/pci/cx88/cx88-input.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ static int __cx88_ir_start(void *priv)
190190
ir = core->ir;
191191

192192
if (ir->polling) {
193-
hrtimer_init(&ir->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
194-
ir->timer.function = cx88_ir_work;
193+
hrtimer_setup(&ir->timer, cx88_ir_work, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
195194
hrtimer_start(&ir->timer,
196195
ktime_set(0, ir->polling * 1000000),
197196
HRTIMER_MODE_REL);

drivers/media/platform/chips-media/wave5/wave5-vpu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ static int wave5_vpu_probe(struct platform_device *pdev)
269269
dev->irq = platform_get_irq(pdev, 0);
270270
if (dev->irq < 0) {
271271
dev_err(&pdev->dev, "failed to get irq resource, falling back to polling\n");
272-
hrtimer_init(&dev->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
273-
dev->hrtimer.function = &wave5_vpu_timer_callback;
272+
hrtimer_setup(&dev->hrtimer, &wave5_vpu_timer_callback, CLOCK_MONOTONIC,
273+
HRTIMER_MODE_REL_PINNED);
274274
dev->worker = kthread_run_worker(0, "vpu_irq_thread");
275275
if (IS_ERR(dev->worker)) {
276276
dev_err(&pdev->dev, "failed to create vpu irq worker\n");

drivers/media/rc/pwm-ir-tx.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ static int pwm_ir_probe(struct platform_device *pdev)
172172
rcdev->tx_ir = pwm_ir_tx_sleep;
173173
} else {
174174
init_completion(&pwm_ir->tx_done);
175-
hrtimer_init(&pwm_ir->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
176-
pwm_ir->timer.function = pwm_ir_timer;
175+
hrtimer_setup(&pwm_ir->timer, pwm_ir_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
177176
rcdev->tx_ir = pwm_ir_tx_atomic;
178177
}
179178

0 commit comments

Comments
 (0)