Add support for IRQ_NOAUTOEN in __set_irq_handler
PATCH 1/1 Add support for IRQ_NOAUTOEN in __set_irq_handler
Any reason for __set_irq_handler not supporting the IRQ_NOAUTOEN flag?
/Esben
kernel/irq/chip.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-)
kernel/irq/chip.c +0 -0
@@ -584,10 +584,15 @@ __set_irq_handler(unsigned int irq,
irq_flow_handler_t handle, int is_chained,
desc->name = name;
if (handle != handle_bad_irq && is_chained) {
- desc->status &= ~IRQ_DISABLED;
desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE;
- desc->depth = 0;
- desc->chip->unmask(irq);
+ if (!(desc->status & IRQ_NOAUTOEN)) {
+ desc->depth = 0;
+ desc->status &= ~IRQ_DISABLED;
+ desc->chip->unmask(irq);
+ } else {
+ /* Undo nested disables: */
+ desc->depth = 1;
+ }
}
spin_unlock_irqrestore(&desc->lock, flags);
}
Signature · 4 lines
Esben Haabendal, Senior Software Consultant DoréDevelopment ApS, Ved Stranden 1, 9560 Hadsund, DK-Denmark Tlf: +45 51 92 53 93, mail: [email protected] WWW: http://www.doredevelopment.dk
Currently, IRQ_NOAUTOEN is only supported with request_irq, and not fx. set_irq_chained_handler(). As the IRQ_NOAUTOEN flag is silently ignored by __set_irq_handler, you risk writing faulty code that start with irq enabled although the developer expects irq disabled.
If the flag is not handled, wouldn't it make sense to return an error?
/Esben
Quoted 32 lines · Esben Haabendal
Any reason for
__set_irq_handlernot supporting theIRQ_NOAUTOENflag?/Esben
kernel/irq/chip.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-)kernel/irq/chip.c +8
-3@@ -584,10 +584,15 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, desc->name = name;if (handle != handle_bad_irq && is_chained) { - desc->status &= ~IRQ_DISABLED ; desc->status |=IRQ_NOREQUEST |IRQ_NOPROBE ; - desc->depth =0 ; - desc->chip->unmask (irq); +if (!(desc->status &IRQ_NOAUTOEN )) { + desc->depth =0 ; + desc->status &= ~IRQ_DISABLED ; + desc->chip->unmask (irq); + }else { +/* Undo nested disables: */ + desc->depth =1 ; + } }spin_unlock_irqrestore (&desc->lock, flags);}