Re: [PATCH v2 1/5] media: ivtv: convert to kthread_run_worker
From: Bradley Morgan <hidden>
Date: 2026-09-04 10:44:23
Also in:
linux-media, linux-pm, linux-serial, lkml
On 4 September 2026 10:37:53 BST, Bradley Morgan [off-list ref] wrote:
Convert ivtv to use kthread_run_worker() instead of the deprecated kthread_run(kthread_worker_fn) pattern. The new API sets worker->task before the worker starts.
This doesn't compile, I'm aware. Fixing in V3, everything else should compile. Received a off list mail from the CI.
quoted hunk ↗ jump to hunk
Signed-off-by: Bradley Morgan <redacted> --- drivers/media/pci/ivtv/ivtv-driver.c | 14 ++++++-------- drivers/media/pci/ivtv/ivtv-driver.h | 3 +-- 2 files changed, 7 insertions(+), 10 deletions(-)diff --git a/drivers/media/pci/ivtv/ivtv-driver.c b/drivers/media/pci/ivtv/ivtv-driver.c index b9ea56ec9593..6f0e0e46deb5 100644 --- a/drivers/media/pci/ivtv/ivtv-driver.c +++ b/drivers/media/pci/ivtv/ivtv-driver.c@@ -703,15 +703,13 @@ static int ivtv_init_struct1(struct ivtv *itv)spin_lock_init(&itv->lock); spin_lock_init(&itv->dma_reg_lock); - kthread_init_worker(&itv->irq_worker); - itv->irq_worker_task = kthread_run(kthread_worker_fn, &itv->irq_worker, - "%s", itv->v4l2_dev.name); - if (IS_ERR(itv->irq_worker_task)) { + itv->irq_worker = kthread_run_worker(0, "%s", itv->v4l2_dev.name); + if (IS_ERR(itv->irq_worker)) { IVTV_ERR("Could not create ivtv task\n"); return -1; } /* must use the FIFO scheduler as it is realtime sensitive */ - sched_set_fifo(itv->irq_worker_task); + sched_set_fifo(itv->irq_worker->task); kthread_init_work(&itv->irq_work, ivtv_irq_work_handler);@@ -1232,7 +1230,7 @@ static int ivtv_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)v4l2_ctrl_handler_free(&itv->cxhdl.hdl); exit_ivtv_i2c(itv); free_worker: - kthread_stop(itv->irq_worker_task); + kthread_destroy_worker(itv->irq_worker); err: if (retval == 0) retval = -ENODEV;@@ -1372,8 +1370,8 @@ static void ivtv_remove(struct pci_dev *pdev)timer_shutdown_sync(&itv->dma_timer); /* Kill irq worker */ - kthread_flush_worker(&itv->irq_worker); - kthread_stop(itv->irq_worker_task); + kthread_flush_worker(itv->irq_worker); + kthread_destroy_worker(itv->irq_worker); ivtv_streams_cleanup(itv); ivtv_udma_free(itv);diff --git a/drivers/media/pci/ivtv/ivtv-driver.h b/drivers/media/pci/ivtv/ivtv-driver.h index 000e8beecc7c..091bc44f13bc 100644 --- a/drivers/media/pci/ivtv/ivtv-driver.h +++ b/drivers/media/pci/ivtv/ivtv-driver.h@@ -668,8 +668,7 @@ struct ivtv {/* Interrupts & DMA */ u32 irqmask; /* active interrupts */ u32 irq_rr_idx; /* round-robin stream index */ - struct kthread_worker irq_worker; /* kthread worker for PIO/YUV/VBI actions */ - struct task_struct *irq_worker_task; /* task for irq_worker */ + struct kthread_worker *irq_worker; /* kthread worker for PIO/YUV/VBI actions */ struct kthread_work irq_work; /* kthread work entry */ spinlock_t dma_reg_lock; /* lock access to DMA engine registers */ int cur_dma_stream; /* index of current stream doing DMA (-1 if none) */
--- Thanks!https://lore.kernel.org/all/EE579805-42F2-4C58-B752-F28779EEB717@grrlz.net/ (local)