Skip to content

Commit

Permalink
genirq: do not leave interupts enabled on free_irq
Browse files Browse the repository at this point in the history
The default_disable() function was changed in commit:

 76d2160
 genirq: do not mask interrupts by default

It removed the mask function in favour of the default delayed
interrupt disabling. Unfortunately this also broke the shutdown in
free_irq() when the last handler is removed from the interrupt for
those architectures which rely on the default implementations. Now we
can end up with a enabled interrupt line after the last handler was
removed, which can result in spurious interrupts.

Fix this by adding a default_shutdown function, which is only
installed, when the irqchip implementation does provide neither a
shutdown nor a disable function.

[@stable: affected versions: .21 - .24 ]

Pointed-out-by: Michael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: stable@kernel.org
Tested-by: Michael Hennerich <Michael.Hennerich@analog.com>
  • Loading branch information
Thomas Gleixner committed Feb 19, 2008
1 parent 188fd89 commit 89d694b
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion kernel/irq/chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,17 @@ static unsigned int default_startup(unsigned int irq)
return 0;
}

/*
* default shutdown function
*/
static void default_shutdown(unsigned int irq)
{
struct irq_desc *desc = irq_desc + irq;

desc->chip->mask(irq);
desc->status |= IRQ_MASKED;
}

/*
* Fixup enable/disable function pointers
*/
Expand All @@ -256,8 +267,15 @@ void irq_chip_set_defaults(struct irq_chip *chip)
chip->disable = default_disable;
if (!chip->startup)
chip->startup = default_startup;
/*
* We use chip->disable, when the user provided its own. When
* we have default_disable set for chip->disable, then we need
* to use default_shutdown, otherwise the irq line is not
* disabled on free_irq():
*/
if (!chip->shutdown)
chip->shutdown = chip->disable;
chip->shutdown = chip->disable != default_disable ?
chip->disable : default_shutdown;
if (!chip->name)
chip->name = chip->typename;
if (!chip->end)
Expand Down

0 comments on commit 89d694b

Please sign in to comment.