patch-2.1.122 linux/arch/i386/kernel/irq.c

Next file: linux/arch/i386/kernel/irq.h
Previous file: linux/arch/i386/kernel/io_apic.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.121/linux/arch/i386/kernel/irq.c linux/arch/i386/kernel/irq.c
@@ -37,9 +37,9 @@
 #include <asm/smp.h>
 #include <asm/pgtable.h>
 #include <asm/delay.h>
+#include <asm/desc.h>
 
 #include "irq.h"
-#include "desc.h"
 
 unsigned int local_bh_count[NR_CPUS];
 unsigned int local_irq_count[NR_CPUS];
@@ -84,6 +84,10 @@
 static void enable_8259A_irq(unsigned int irq);
 void disable_8259A_irq(unsigned int irq);
 
+/* startup is the same as "enable", shutdown is same as "disable" */
+#define startup_8259A_irq	enable_8259A_irq
+#define shutdown_8259A_irq	disable_8259A_irq
+
 /*
  * Dummy controller type for unused interrupts
  */
@@ -91,8 +95,14 @@
 static void enable_none(unsigned int irq) { }
 static void disable_none(unsigned int irq) { }
 
+/* startup is the same as "enable", shutdown is same as "disable" */
+#define startup_none	enable_none
+#define shutdown_none	disable_none
+
 static struct hw_interrupt_type no_irq_type = {
 	"none",
+	startup_none,
+	shutdown_none,
 	do_none,
 	enable_none,
 	disable_none
@@ -100,6 +110,8 @@
 
 static struct hw_interrupt_type i8259A_irq_type = {
 	"XT-PIC",
+	startup_8259A_irq,
+	shutdown_8259A_irq,
 	do_8259A_IRQ,
 	enable_8259A_irq,
 	disable_8259A_irq
@@ -683,7 +695,8 @@
 	irq_desc[irq].handler->disable(irq);
 	spin_unlock_irqrestore(&irq_controller_lock, flags);
 
-	synchronize_irq();
+	if (irq_desc[irq].status & IRQ_INPROGRESS)
+		synchronize_irq();
 }
 
 void enable_irq(unsigned int irq)
@@ -699,7 +712,7 @@
 	 * install a handler for this interrupt (make irq autodetection
 	 * work by just looking at the status field for the irq)
 	 */
-	irq_desc[irq].status = 0;
+	irq_desc[irq].status &= ~(IRQ_DISABLED | IRQ_INPROGRESS);
 	irq_desc[irq].handler->enable(irq);
 	spin_unlock_irqrestore(&irq_controller_lock, flags);
 }
@@ -785,22 +798,8 @@
 	*p = new;
 
 	if (!shared) {
-		irq_desc[irq].status = 0;
-#ifdef __SMP__
-		if (IO_APIC_IRQ(irq)) {
-			/*
-			 * If it was on a 8259, disable it there
-			 * and move the "pendingness" onto the
-			 * new irq descriptor.
-			 */
-			if (irq < 16) {
-				disable_8259A_irq(irq);
-				if (i8259A_irq_pending(irq))
-					irq_desc[irq].status = IRQ_PENDING;
-			}
-		}
-#endif
-		irq_desc[irq].handler->enable(irq);
+		irq_desc[irq].status &= ~(IRQ_DISABLED | IRQ_INPROGRESS);
+		irq_desc[irq].handler->startup(irq);
 	}
 	spin_unlock_irqrestore(&irq_controller_lock,flags);
 	return 0;
@@ -857,7 +856,7 @@
 		kfree(action);
 		if (!irq_desc[irq].action) {
 			irq_desc[irq].status |= IRQ_DISABLED;
-			irq_desc[irq].handler->disable(irq);
+			irq_desc[irq].handler->shutdown(irq);
 		}
 		goto out;
 	}
@@ -886,8 +885,8 @@
 	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_PENDING);
-			irq_desc[i].handler->enable(i);
+			irq_desc[i].status = status & ~IRQ_INPROGRESS;
+			irq_desc[i].handler->startup(i);
 		}
 	}
 	spin_unlock_irq(&irq_controller_lock);
@@ -911,7 +910,7 @@
 		/* It triggered already - consider it spurious. */
 		if (status & IRQ_INPROGRESS) {
 			irq_desc[i].status = status & ~IRQ_AUTODETECT;
-			irq_desc[i].handler->disable(i);
+			irq_desc[i].handler->shutdown(i);
 		}
 	}
 	spin_unlock_irq(&irq_controller_lock);
@@ -941,7 +940,7 @@
 			nr_irqs++;
 		}
 		irq_desc[i].status = status & ~IRQ_AUTODETECT;
-		irq_desc[i].handler->disable(i);
+		irq_desc[i].handler->shutdown(i);
 	}
 	spin_unlock_irq(&irq_controller_lock);
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov