x86: use NR_IRQS_LEGACY
authorYinghai Lu <yinghai@kernel.org>
Sat, 6 Dec 2008 02:58:32 +0000 (18:58 -0800)
committerIngo Molnar <mingo@elte.hu>
Mon, 8 Dec 2008 13:31:52 +0000 (14:31 +0100)
Impact: cleanup

Introduce NR_IRQS_LEGACY instead of hard coded number.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/include/asm/irq_vectors.h
arch/x86/kernel/io_apic.c
arch/x86/kernel/irqinit_32.c
arch/x86/kernel/irqinit_64.c
kernel/irq/handle.c

index bb6b69a6b12575408f8b34b0e818d4c920ff7386..f7ff65032b9d66aee077fcc3ddbcddd40bd4f75d 100644 (file)
 #define LAST_VM86_IRQ          15
 #define invalid_vm86_irq(irq)  ((irq) < 3 || (irq) > 15)
 
+#define NR_IRQS_LEGACY         16
+
 #if defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_X86_VOYAGER)
 
 #ifndef CONFIG_SPARSE_IRQ
index 9de17f5c112520897faf5b2f02e352f62a9ec1fa..9870461ae9330c5999a03c901676ae8b07343ba2 100644 (file)
@@ -847,7 +847,7 @@ EXPORT_SYMBOL(IO_APIC_get_PCI_irq_vector);
  */
 static int EISA_ELCR(unsigned int irq)
 {
-       if (irq < 16) {
+       if (irq < NR_IRQS_LEGACY) {
                unsigned int port = 0x4d0 + (irq >> 3);
                return (inb(port) >> (irq & 7)) & 1;
        }
@@ -1388,7 +1388,7 @@ static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq,
        }
 
        ioapic_register_intr(irq, trigger);
-       if (irq < 16)
+       if (irq < NR_IRQS_LEGACY)
                disable_8259A_irq(irq);
 
        ioapic_write_entry(apic, pin, entry);
@@ -2080,7 +2080,7 @@ static unsigned int startup_ioapic_irq(unsigned int irq)
        struct irq_cfg *cfg;
 
        spin_lock_irqsave(&ioapic_lock, flags);
-       if (irq < 16) {
+       if (irq < NR_IRQS_LEGACY) {
                disable_8259A_irq(irq);
                if (i8259A_irq_pending(irq))
                        was_pending = 1;
@@ -2504,7 +2504,7 @@ static inline void init_IO_APIC_traps(void)
                         * so default to an old-fashioned 8259
                         * interrupt if we can..
                         */
-                       if (irq < 16)
+                       if (irq < NR_IRQS_LEGACY)
                                make_8259A_irq(irq);
                        else
                                /* Strange. Oh, well.. */
@@ -3794,7 +3794,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int p
        /*
         * IRQs < 16 are already in the irq_2_pin[] map
         */
-       if (irq >= 16) {
+       if (irq >= NR_IRQS_LEGACY) {
                cfg = desc->chip_data;
                add_pin_to_irq_cpu(irq, cpu, ioapic, pin);
        }
index 5a5651b7f9e6e96ff48905d51b6014a2c9778595..6a92f47c52e7aa7a29335b30459f82b83cfd7c82 100644 (file)
@@ -68,7 +68,7 @@ void __init init_ISA_irqs (void)
        /*
         * 16 old-style INTA-cycle interrupts:
         */
-       for (i = 0; i < 16; i++) {
+       for (i = 0; i < NR_IRQS_LEGACY; i++) {
                struct irq_desc *desc = irq_to_desc(i);
 
                desc->status = IRQ_DISABLED;
index cd9f42d028d92c8b05fdceeb889ae9df9000793e..40c1e62ec7857dd054930ae1f125df79e2aa524e 100644 (file)
@@ -142,7 +142,7 @@ void __init init_ISA_irqs(void)
        init_bsp_APIC();
        init_8259A(0);
 
-       for (i = 0; i < 16; i++) {
+       for (i = 0; i < NR_IRQS_LEGACY; i++) {
                struct irq_desc *desc = irq_to_desc(i);
 
                desc->status = IRQ_DISABLED;
index 96ca203eb51b65560c91874db4c34a762db6290c..8aa09547f5efe77e9104d02fad0e2f077123887f 100644 (file)
@@ -117,8 +117,8 @@ static DEFINE_SPINLOCK(sparse_irq_lock);
 
 struct irq_desc *irq_desc_ptrs[NR_IRQS] __read_mostly;
 
-static struct irq_desc irq_desc_legacy[16] __cacheline_aligned_in_smp = {
-       [0 ... 15] = {
+static struct irq_desc irq_desc_legacy[NR_IRQS_LEGACY] __cacheline_aligned_in_smp = {
+       [0 ... NR_IRQS_LEGACY-1] = {
                .irq        = -1,
                .status     = IRQ_DISABLED,
                .chip       = &no_irq_chip,
@@ -132,7 +132,7 @@ static struct irq_desc irq_desc_legacy[16] __cacheline_aligned_in_smp = {
 };
 
 /* FIXME: use bootmem alloc ...*/
-static unsigned int kstat_irqs_legacy[16][NR_CPUS];
+static unsigned int kstat_irqs_legacy[NR_IRQS_LEGACY][NR_CPUS];
 
 void __init early_irq_init(void)
 {