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>
This commit is contained in:
parent
90fa028055
commit
f8a27dfa4b
1 changed files with 13 additions and 4 deletions
|
@ -442,18 +442,27 @@ EXPORT_SYMBOL_GPL(uio_event_notify);
|
||||||
* @irq: IRQ number, can be UIO_IRQ_CYCLIC for cyclic timer
|
* @irq: IRQ number, can be UIO_IRQ_CYCLIC for cyclic timer
|
||||||
* @dev_id: Pointer to the devices uio_device structure
|
* @dev_id: Pointer to the devices uio_device structure
|
||||||
*/
|
*/
|
||||||
static irqreturn_t uio_interrupt(int irq, void *dev_id)
|
static irqreturn_t uio_interrupt_handler(int irq, void *dev_id)
|
||||||
{
|
{
|
||||||
struct uio_device *idev = (struct uio_device *)dev_id;
|
struct uio_device *idev = (struct uio_device *)dev_id;
|
||||||
irqreturn_t ret;
|
irqreturn_t ret;
|
||||||
|
|
||||||
ret = idev->info->handler(irq, idev->info);
|
ret = idev->info->handler(irq, idev->info);
|
||||||
if (ret == IRQ_HANDLED)
|
if (ret == IRQ_HANDLED)
|
||||||
uio_event_notify(idev->info);
|
ret = IRQ_WAKE_THREAD;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static irqreturn_t uio_interrupt_thread(int irq, void *dev_id)
|
||||||
|
{
|
||||||
|
struct uio_device *idev = (struct uio_device *)dev_id;
|
||||||
|
|
||||||
|
uio_event_notify(idev->info);
|
||||||
|
|
||||||
|
return IRQ_HANDLED;
|
||||||
|
}
|
||||||
|
|
||||||
struct uio_listener {
|
struct uio_listener {
|
||||||
struct uio_device *dev;
|
struct uio_device *dev;
|
||||||
s32 event_count;
|
s32 event_count;
|
||||||
|
@ -1024,8 +1033,8 @@ int __uio_register_device(struct module *owner,
|
||||||
* FDs at the time of unregister and therefore may not be
|
* FDs at the time of unregister and therefore may not be
|
||||||
* freed until they are released.
|
* freed until they are released.
|
||||||
*/
|
*/
|
||||||
ret = request_irq(info->irq, uio_interrupt,
|
ret = request_threaded_irq(info->irq, uio_interrupt_handler, uio_interrupt_thread,
|
||||||
info->irq_flags, info->name, idev);
|
info->irq_flags, info->name, idev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
info->uio_dev = NULL;
|
info->uio_dev = NULL;
|
||||||
goto err_request_irq;
|
goto err_request_irq;
|
||||||
|
|
Loading…
Add table
Reference in a new issue