Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

uio: use threaded interrupts

Split the existing uio_interrupt into a hardirq handler and a thread
function. The hardirq handler deals with the interrupt source in
hardware, the thread function notifies userspace that there is an event
to be handled.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20240408234050.2056374-3-chris.packham@alliedtelesis.co.nz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Chris Packham and committed by
Greg Kroah-Hartman
f8a27dfa 90fa0280

+13 -4
+13 -4
drivers/uio/uio.c
··· 442 442 * @irq: IRQ number, can be UIO_IRQ_CYCLIC for cyclic timer 443 443 * @dev_id: Pointer to the devices uio_device structure 444 444 */ 445 - static irqreturn_t uio_interrupt(int irq, void *dev_id) 445 + static irqreturn_t uio_interrupt_handler(int irq, void *dev_id) 446 446 { 447 447 struct uio_device *idev = (struct uio_device *)dev_id; 448 448 irqreturn_t ret; 449 449 450 450 ret = idev->info->handler(irq, idev->info); 451 451 if (ret == IRQ_HANDLED) 452 - uio_event_notify(idev->info); 452 + ret = IRQ_WAKE_THREAD; 453 453 454 454 return ret; 455 + } 456 + 457 + static irqreturn_t uio_interrupt_thread(int irq, void *dev_id) 458 + { 459 + struct uio_device *idev = (struct uio_device *)dev_id; 460 + 461 + uio_event_notify(idev->info); 462 + 463 + return IRQ_HANDLED; 455 464 } 456 465 457 466 struct uio_listener { ··· 1033 1024 * FDs at the time of unregister and therefore may not be 1034 1025 * freed until they are released. 1035 1026 */ 1036 - ret = request_irq(info->irq, uio_interrupt, 1037 - info->irq_flags, info->name, idev); 1027 + ret = request_threaded_irq(info->irq, uio_interrupt_handler, uio_interrupt_thread, 1028 + info->irq_flags, info->name, idev); 1038 1029 if (ret) { 1039 1030 info->uio_dev = NULL; 1040 1031 goto err_request_irq;