public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] let setup_irq reenable a shared irq
@ 2008-04-28 11:12 Uwe Kleine-König
  2008-04-28 13:03 ` Thomas Gleixner
  0 siblings, 1 reply; 11+ messages in thread
From: Uwe Kleine-König @ 2008-04-28 11:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Thomas Gleixner

Consider two devices A and B sharing an irq and B already asserts the irq on
a booting machine.
If the driver for A is loaded first the irq starts triggering and gets
disabled after some time by note_interrupt().  Later when the driver for B
is loaded the interrupt should be reenabled---other wise both A and B don't
work properly.

Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/irq/manage.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 438a014..831ebb2 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -365,11 +365,18 @@ int setup_irq(unsigned int irq, struct irqaction *new)
 
 		desc->status &= ~(IRQ_AUTODETECT | IRQ_WAITING |
 				  IRQ_INPROGRESS);
+	}
+
+	/* in the shared case the interrupt might be disabled if a device
+	 * asserts the irq but the corresponding driver wasn't the first to be
+	 * loaded.  So retry enabling the irq.
+	 */
+	if (!shared || desc->status & IRQ_DISABLED) {
 
 		if (!(desc->status & IRQ_NOAUTOEN)) {
 			desc->depth = 0;
 			desc->status &= ~IRQ_DISABLED;
-			if (desc->chip->startup)
+			if (!shared && desc->chip->startup)
 				desc->chip->startup(irq);
 			else
 				desc->chip->enable(irq);
-- 
1.5.5.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-04-30 21:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1209557398-8228-1-git-send-email-Uwe.Kleine-Koenig@digi.com>
2008-04-30 12:32 ` [PATCH] let setup_irq reenable a shared irq Thomas Gleixner
2008-04-30 12:38   ` Andrew Morton
2008-04-30 12:43     ` Thomas Gleixner
2008-04-28 11:12 Uwe Kleine-König
2008-04-28 13:03 ` Thomas Gleixner
2008-04-28 14:11   ` Uwe Kleine-König
2008-04-28 16:10     ` Thomas Gleixner
2008-04-29 13:08       ` Uwe Kleine-König
2008-04-29 16:23         ` Thomas Gleixner
2008-04-30 21:19       ` Eric W. Biederman
2008-04-30 21:36         ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox