## Automatically generated incremental diff
## From:   linux-2.2.8-pre1
## To:     linux-2.2.8-pre2
## Robot:  $Id: make-incremental-diff,v 1.11 2002/02/20 02:59:33 hpa Exp $

diff -urN linux-2.2.8-pre1/arch/i386/kernel/io_apic.c linux-2.2.8-pre2/arch/i386/kernel/io_apic.c
--- linux-2.2.8-pre1/arch/i386/kernel/io_apic.c	2003-08-15 15:05:56.000000000 -0700
+++ linux-2.2.8-pre2/arch/i386/kernel/io_apic.c	2003-08-15 15:05:57.000000000 -0700
@@ -1049,7 +1049,7 @@
 	 * and do not need to be masked.
 	 */
 	ack_APIC_irq();
-	status = desc->status & ~IRQ_REPLAY;
+	status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
 	status |= IRQ_PENDING;
 
 	/*
@@ -1104,7 +1104,7 @@
 	 * So this all has to be within the spinlock.
 	 */
 	mask_IO_APIC_irq(irq);
-	status = desc->status & ~IRQ_REPLAY;
+	status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
 
 	/*
 	 * If the IRQ is disabled for whatever reason, we must
diff -urN linux-2.2.8-pre1/arch/i386/kernel/irq.c linux-2.2.8-pre2/arch/i386/kernel/irq.c
--- linux-2.2.8-pre1/arch/i386/kernel/irq.c	2003-08-15 15:05:56.000000000 -0700
+++ linux-2.2.8-pre2/arch/i386/kernel/irq.c	2003-08-15 15:05:57.000000000 -0700
@@ -239,10 +239,9 @@
 	{
 		unsigned int status;
 		mask_and_ack_8259A(irq);
-		status = desc->status & ~IRQ_REPLAY;
+		status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
 		action = NULL;
-		if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS)))
-		{
+		if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
 			action = desc->action;
 			status |= IRQ_INPROGRESS;
 		}
@@ -770,7 +769,7 @@
 {
 	disable_irq_nosync(irq);
 
-	if (!local_irq_count[smp_processor_id()] && irq_desc[irq].action) {
+	if (!local_irq_count[smp_processor_id()]) {
 		do {
 			barrier();
 		} while (irq_desc[irq].status & IRQ_INPROGRESS);
@@ -879,7 +878,7 @@
 
 	if (!shared) {
 		irq_desc[irq].depth = 0;
-		irq_desc[irq].status &= ~(IRQ_DISABLED | IRQ_INPROGRESS);
+		irq_desc[irq].status &= ~IRQ_DISABLED;
 		irq_desc[irq].handler->startup(irq);
 	}
 	spin_unlock_irqrestore(&irq_controller_lock,flags);
@@ -951,7 +950,7 @@
  *
  * This depends on the fact that any interrupt that
  * comes in on to an unassigned handler will get stuck
- * with "IRQ_INPROGRESS" asserted and the interrupt
+ * with "IRQ_WAITING" cleared and the interrupt
  * disabled.
  */
 unsigned long probe_irq_on(void)
@@ -965,8 +964,7 @@
 	spin_lock_irq(&irq_controller_lock);
 	for (i = NR_IRQS-1; i > 0; i--) {
 		if (!irq_desc[i].action) {
-			unsigned int status = irq_desc[i].status | IRQ_AUTODETECT;
-			irq_desc[i].status = status & ~(IRQ_INPROGRESS|IRQ_DISABLED);
+			irq_desc[i].status |= IRQ_AUTODETECT | IRQ_WAITING;
 			irq_desc[i].handler->startup(i);
 		}
 	}
@@ -989,8 +987,8 @@
 			continue;
 		
 		/* It triggered already - consider it spurious. */
-		if (status & IRQ_INPROGRESS) {
-			irq_desc[i].status = (status & ~(IRQ_INPROGRESS | IRQ_AUTODETECT)) | IRQ_DISABLED;
+		if (!(status & IRQ_WAITING)) {
+			irq_desc[i].status = status & ~IRQ_AUTODETECT;
 			irq_desc[i].handler->shutdown(i);
 		}
 	}
@@ -1015,12 +1013,12 @@
 		if (!(status & IRQ_AUTODETECT))
 			continue;
 
-		if (status & IRQ_INPROGRESS) {
+		if (!(status & IRQ_WAITING)) {
 			if (!nr_irqs)
 				irq_found = i;
 			nr_irqs++;
 		}
-		irq_desc[i].status = (status & ~(IRQ_AUTODETECT | IRQ_INPROGRESS)) | IRQ_DISABLED;
+		irq_desc[i].status = status & ~IRQ_AUTODETECT;
 		irq_desc[i].handler->shutdown(i);
 	}
 	spin_unlock_irq(&irq_controller_lock);
diff -urN linux-2.2.8-pre1/arch/i386/kernel/irq.h linux-2.2.8-pre2/arch/i386/kernel/irq.h
--- linux-2.2.8-pre1/arch/i386/kernel/irq.h	1999-04-27 09:57:47.000000000 -0700
+++ linux-2.2.8-pre2/arch/i386/kernel/irq.h	2003-08-15 15:05:57.000000000 -0700
@@ -26,6 +26,7 @@
 #define IRQ_PENDING	4	/* IRQ pending - replay on enable */
 #define IRQ_REPLAY	8	/* IRQ has been replayed but not acked yet */
 #define IRQ_AUTODETECT	16	/* IRQ is being autodetected */
+#define IRQ_WAITING	32	/* IRQ not yet seen - for autodetection */
 
 /*
  * This is the "IRQ descriptor", which contains various information
diff -urN linux-2.2.8-pre1/arch/i386/kernel/visws_apic.c linux-2.2.8-pre2/arch/i386/kernel/visws_apic.c
--- linux-2.2.8-pre1/arch/i386/kernel/visws_apic.c	2003-08-15 15:05:56.000000000 -0700
+++ linux-2.2.8-pre2/arch/i386/kernel/visws_apic.c	2003-08-15 15:05:57.000000000 -0700
@@ -201,10 +201,9 @@
 	{
 		unsigned int status;
 		/* XXX APIC EOI? */
-		status = desc->status & ~IRQ_REPLAY;
+		status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
 		action = NULL;
-		if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS)))
-		{
+		if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
 			action = desc->action;
 			status |= IRQ_INPROGRESS;
 		}
