request_irq() usage in wm8350_register_irq().
Hi,
I've been staring wm8350_register_irq(). It does
| request_threaded_irq(irq + wm8350->irq_base, NULL,
| handler, flags, name, data);
and every single user passes 0 as flags. This means it asks for a threaded IRQ and does not pass IRQF_ONESHOT.
So either this is not working because it triggers the warnings
Threaded irq requested with handler=NULL and !ONESHOT
followed by -EINVAL _or_ every single user of this driver sits in system where the irqchip is IRQCHIP_ONESHOT_SAFE marked. Which is it?
Sebastian
Quoted 10 lines · Sebastian Andrzej Siewior
Hi,
I've been staring
wm8350_register_irq(). It does| request_threaded_irq(irq +
wm8350->irq_base, NULL,
| handler, flags, name, data);and every single user passes 0 as flags. This means it asks for a threaded IRQ and does not pass
IRQF_ONESHOT.
Quoted 8 lines
So either this is not working because it triggers the warnings
Threaded irq requested with handler=NULL and !ONESHOTfollowed by
-EINVAL_or_ every single user of this driver sits in system where the irqchip isIRQCHIP_ONESHOT_SAFEmarked. Which is it?Sebastian
Or because request_threaded_irq() supplies a default handler, so handler!=NULL when it calls __setup_irq().
int request_threaded_irq(unsigned int irq, irq_handler_t handler,
irq_handler_t thread_fn, unsigned long irqflags, const char *devname, void *dev_id)
{
...
if (!handler) {
if (!thread_fn)
return -EINVAL;
handler = irq_default_primary_handler;
}...
retval = __setup_irq(irq, desc, action);
...
}
Quoted 17 lines · Richard Fitzgerald
Or because
request_threaded_irq()supplies a default handler, so handler!=NULL when it calls__setup_irq().int request_threaded_irq(unsigned int irq,
irq_handler_thandler,
irq_handler_tthread_fn, unsigned long irqflags, const char *devname, void*dev_id)
{...
if (!handler) { if (!thread_fn) return -EINVAL; handler = irq_default_primary_handler; }
Quoted 7 lines
...
retval = __setup_irq(irq, desc, action);...
}
->
| } else if (new->handler == irq_default_primary_handler &&
| !(desc->irq_data.chip->flags & IRQCHIP_ONESHOT_SAFE)) {
…
| pr_err("Threaded irq requested with handler=NULL and !ONESHOT for %s (irq %d)\n",
| new->name, irq);
| ret = -EINVAL;Sebastian
Quoted 28 lines · Sebastian Andrzej Siewior
Quoted 17 lines · Richard Fitzgerald
Or because
request_threaded_irq()supplies a default handler, so handler!=NULL when it calls__setup_irq().int request_threaded_irq(unsigned int irq,
irq_handler_thandler,
irq_handler_tthread_fn, unsigned long irqflags, const char *devname, void*dev_id)
{...
if (!handler) { if (!thread_fn) return -EINVAL; handler = irq_default_primary_handler; }Quoted 7 lines
...
retval = __setup_irq(irq, desc, action);...
}->
Quoted 8 lines
| } else if (
new->handler==irq_default_primary_handler&&
| !(desc->irq_data.chip->flags &IRQCHIP_ONESHOT_SAFE)) {
…| pr_err("Threaded irq requested with handler=NULL and !ONESHOT for %s (irq %d)\n", | new->name, irq); | ret = -EINVAL;Sebastian
Ah. I didn't notice that. Confusing error message. It says "handler=NULL" but handler != NULL. More like "handler=default".
Quoted 2 lines · Richard Fitzgerald
Ah. I didn't notice that. Confusing error message. It says "handler=NULL" but handler != NULL. More like "handler=default".
The supplied argument was NULL.
Anyway. Do you happen to have an answer to my original question.
Sebastian
Quoted 6 lines · Sebastian Andrzej Siewior
Quoted 2 lines · Richard Fitzgerald
Ah. I didn't notice that. Confusing error message. It says "handler=NULL" but handler != NULL. More like "handler=default".
The supplied argument was NULL.
Anyway. Do you happen to have an answer to my original question.
Why not asking Mark? I think he might know more about this HW.
Btw, Mark, I noticed that your old addresses appear in Git history, are they working? Or do you want to add them into .mailmap?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 9 lines · Andy Shevchenko
Quoted 6 lines · Sebastian Andrzej Siewior
Quoted 2 lines · Richard Fitzgerald
Ah. I didn't notice that. Confusing error message. It says "handler=NULL" but handler != NULL. More like "handler=default".
The supplied argument was NULL.
Anyway. Do you happen to have an answer to my original question.Why not asking Mark? I think he might know more about this HW.
What was the question?
Quoted 2 lines
Btw, Mark, I noticed that your old addresses appear in Git history, are they working? Or do you want to add them into .mailmap?
They'll be broken but I'm not sure I care.
Quoted 1 line · Mark Brown
What was the question?
to quote myself:
I've been staring wm8350_register_irq(). It does
| request_threaded_irq(irq + wm8350->irq_base, NULL,
| handler, flags, name, data);
and every single user passes 0 as flags. This means it asks for a threaded IRQ and does not pass IRQF_ONESHOT.
So either this is not working because it triggers the warnings
Threaded irq requested with handler=NULL and !ONESHOT
followed by -EINVAL _or_ every single user of this driver sits in system where the irqchip is IRQCHIP_ONESHOT_SAFE marked. Which is it?
Sebastian
Quoted 8 lines · Sebastian Andrzej Siewior
I've been staring
wm8350_register_irq(). It does| request_threaded_irq(irq +
wm8350->irq_base, NULL,
| handler, flags, name, data);and every single user passes 0 as flags. This means it asks for a threaded IRQ and does not pass
IRQF_ONESHOT.
Quoted 6 lines
So either this is not working because it triggers the warnings
Threaded irq requested with handler=NULL and !ONESHOTfollowed by
-EINVAL_or_ every single user of this driver sits in system where the irqchip isIRQCHIP_ONESHOT_SAFEmarked. Which is it?
The chip is only accessable via I2C or SPI so the primary interrupt handler is itself always running and reporting child interrupts in threaded context. They can't really deliver a hardirq context interrupt.
Quoted 13 lines · Mark Brown
Quoted 10 lines · Sebastian Andrzej Siewior
I've been staring
wm8350_register_irq(). It does| request_threaded_irq(irq +
wm8350->irq_base, NULL,
| handler, flags, name, data);and every single user passes 0 as flags. This means it asks for a threaded IRQ and does not pass
IRQF_ONESHOT.So either this is not working because it triggers the warnings
Threaded irq requested with handler=NULL and !ONESHOT
Quoted 8 lines
Quoted 3 lines
followed by
-EINVAL_or_ every single user of this driver sits in system where the irqchip isIRQCHIP_ONESHOT_SAFEmarked. Which is it?The chip is only accessable via I2C or SPI so the primary interrupt handler is itself always running and reporting child interrupts in threaded context. They can't really deliver a hardirq context interrupt.
In that case it lacks the needed IRQF_ONEHOST flag and nobody noticed that request_irq() fails for a few years now. I add a patch to my stack…
Thanks Mark.
Sebastian
Quoted 10 lines · Sebastian Andrzej Siewior
Quoted 4 lines · Mark Brown
The chip is only accessable via I2C or SPI so the primary interrupt handler is itself always running and reporting child interrupts in threaded context. They can't really deliver a hardirq context interrupt.
In that case it lacks the needed
IRQF_ONEHOSTflag and nobody noticed thatrequest_irq()fails for a few years now. I add a patch to my stack…
Thanks.
Quoted 3 lines · Mark Brown
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Sebastian Andrzej Siewior
On 2026-01-21 11:53:28 [+0000], Richard Fitzgerald wrote:
...
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Ah. I didn't notice that. Confusing error message. It says "handler=NULL" but handler != NULL. More like "handler=default".
The supplied argument was NULL.
Anyway. Do you happen to have an answer to my original question.Why not asking Mark? I think he might know more about this HW.
What was the question?
How does the IRQ handling work in this multifunctional device for its children? @bigeasy is puzzled here and he started this thread.
Quoted 4 lines
Quoted 2 lines
Btw, Mark, I noticed that your old addresses appear in Git history, are they working? Or do you want to add them into .mailmap?
They'll be broken but I'm not sure I care.
Hmm... I would have sent this email to your wolfsonmicro address :-)
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 8 lines · Sebastian Andrzej Siewior
Quoted 2 lines · Richard Fitzgerald
Ah. I didn't notice that. Confusing error message. It says "handler=NULL" but handler != NULL. More like "handler=default".
The supplied argument was NULL.
Anyway. Do you happen to have an answer to my original question.Sebastian
Afraid I'm not familiar with the WM8350.
But I note that call is not registering against a real interrupt pin. It's registering against a virtual irqchip that is itself a threaded IRQ handler. Maybe that makes a difference. That top-level virtual IRQ handler is ONESHOT.
Quoted 8 lines · Richard Fitzgerald
Quoted 7 lines · Sebastian Andrzej Siewior
Quoted 2 lines · Richard Fitzgerald
Ah. I didn't notice that. Confusing error message. It says "handler=NULL" but handler != NULL. More like "handler=default".
The supplied argument was NULL.
Anyway. Do you happen to have an answer to my original question.
Quoted 8 lines
Quoted 1 line
Sebastian
Afraid I'm not familiar with the WM8350.
But I note that call is not registering against a real interrupt pin. It's registering against a virtual irqchip that is itself a threaded IRQ handler. Maybe that makes a difference. That top-level virtual IRQ handler is ONESHOT.
Yeah I suspect there is some trickery like this which means this doesn't actually cause a problem in practice, since these are internal IRQs to the chip, and the IRQ coming out of the chip is marked as one shot. So the alluded to IRQ storm probably can't happen as the chip level IRQ is still masked.
I also note the driver predates the check by a good few years, so it wouldn't have generated any errors whilst being developed. To be fair it has also never been the most heavily used driver, so quite plausible no one has noticed the error message since. I would wager the correct thing to do here is just to add the ONESHOT flag in.
Thanks,
Charles