patches for 2.6.22.20-op1 (review)
[linux-2.6.22.y-op-patches.git] / review-2.6.22.y / genirq-do-not-leave-interupts-enabled-on-free_irq.patch
blobb7f24edda035fc84bf88c2743c4e4b09ced7ba5d
1 From 2cd082a9a5860afa64b032fc6df230e25d913289 Mon Sep 17 00:00:00 2001
2 From: Thomas Gleixner <tglx@linutronix.de>
3 Date: Wed, 20 Feb 2008 00:29:02 +0100
4 Subject: [PATCH] genirq: do not leave interupts enabled on free_irq
6 commit 89d694b9dbe769ca1004e01db0ca43964806a611
8 The default_disable() function was changed in commit:
10 76d2160147f43f982dfe881404cfde9fd0a9da21
11 genirq: do not mask interrupts by default
13 It removed the mask function in favour of the default delayed
14 interrupt disabling. Unfortunately this also broke the shutdown in
15 free_irq() when the last handler is removed from the interrupt for
16 those architectures which rely on the default implementations. Now we
17 can end up with a enabled interrupt line after the last handler was
18 removed, which can result in spurious interrupts.
20 Fix this by adding a default_shutdown function, which is only
21 installed, when the irqchip implementation does provide neither a
22 shutdown nor a disable function.
24 Pointed-out-by: Michael Hennerich <Michael.Hennerich@analog.com>
25 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
26 Acked-by: Ingo Molnar <mingo@elte.hu>
27 Tested-by: Michael Hennerich <Michael.Hennerich@analog.com>
28 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
29 Signed-off-by: Oliver Pinter <oliver.pntr@gmail.com>
31 diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
32 index f1a73f0..7279484 100644
33 --- a/kernel/irq/chip.c
34 +++ b/kernel/irq/chip.c
35 @@ -246,6 +246,17 @@ static unsigned int default_startup(unsigned int irq)
39 + * default shutdown function
40 + */
41 +static void default_shutdown(unsigned int irq)
43 + struct irq_desc *desc = irq_desc + irq;
45 + desc->chip->mask(irq);
46 + desc->status |= IRQ_MASKED;
49 +/*
50 * Fixup enable/disable function pointers
52 void irq_chip_set_defaults(struct irq_chip *chip)
53 @@ -256,8 +267,15 @@ void irq_chip_set_defaults(struct irq_chip *chip)
54 chip->disable = default_disable;
55 if (!chip->startup)
56 chip->startup = default_startup;
57 + /*
58 + * We use chip->disable, when the user provided its own. When
59 + * we have default_disable set for chip->disable, then we need
60 + * to use default_shutdown, otherwise the irq line is not
61 + * disabled on free_irq():
62 + */
63 if (!chip->shutdown)
64 - chip->shutdown = chip->disable;
65 + chip->shutdown = chip->disable != default_disable ?
66 + chip->disable : default_shutdown;
67 if (!chip->name)
68 chip->name = chip->typename;
69 if (!chip->end)