One last thing regarding threaded handlers: the kernel won't blindly allow you to use a threaded handler for any IRQ; it honors some constraints. At the time of registering your thread handler (via the [devm_]request_threaded_irq() APIs), it performs several validity checks, one of which we've mentioned already:Â IRQF_ONESHOTÂ must be present for a threaded handler.
It also depends on the actual IRQ line; for example, I once tried using a threaded handler for IRQ 1 on x86 (it's typically the i8042 keyboard/mouse controller chip's interrupt line). It failed, with the kernel showing the following:
genirq: Flags mismatch irq 1. 00002080 (driver-name) vs. 00000080 (i8042)
So, from the preceding output, we can see that the i8042 will only accept the 0x80 bitmask for the IRQ flags, whereas I passed a value of 0x2080; a little checking will show that the 0x2000 flag is indeed the IRQF_ONESHOT...