aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2008-12-05 21:58:32 -0500
committerIngo Molnar <mingo@elte.hu>2008-12-08 08:31:52 -0500
commit99d093d12897562a253540a902bbf65ec16042ac (patch)
tree34e8ca60b1d47944c7c85b66f84df51526db5f80
parent0b8f1efad30bd58f89961b82dfe68b9edf8fd2ac (diff)
x86: use NR_IRQS_LEGACY
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>
-rw-r--r--arch/x86/include/asm/irq_vectors.h2
-rw-r--r--arch/x86/kernel/io_apic.c10
-rw-r--r--arch/x86/kernel/irqinit_32.c2
-rw-r--r--arch/x86/kernel/irqinit_64.c2
-rw-r--r--kernel/irq/handle.c6
5 files changed, 12 insertions, 10 deletions
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
index bb6b69a6b125..f7ff65032b9d 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -101,6 +101,8 @@
101#define LAST_VM86_IRQ 15 101#define LAST_VM86_IRQ 15
102#define invalid_vm86_irq(irq) ((irq) < 3 || (irq) > 15) 102#define invalid_vm86_irq(irq) ((irq) < 3 || (irq) > 15)
103 103
104#define NR_IRQS_LEGACY 16
105
104#if defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_X86_VOYAGER) 106#if defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_X86_VOYAGER)
105 107
106#ifndef CONFIG_SPARSE_IRQ 108#ifndef CONFIG_SPARSE_IRQ
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c
index 9de17f5c1125..9870461ae933 100644
--- a/arch/x86/kernel/io_apic.c
+++ b/arch/x86/kernel/io_apic.c
@@ -847,7 +847,7 @@ EXPORT_SYMBOL(IO_APIC_get_PCI_irq_vector);
847 */ 847 */
848static int EISA_ELCR(unsigned int irq) 848static int EISA_ELCR(unsigned int irq)
849{ 849{
850 if (irq < 16) { 850 if (irq < NR_IRQS_LEGACY) {
851 unsigned int port = 0x4d0 + (irq >> 3); 851 unsigned int port = 0x4d0 + (irq >> 3);
852 return (inb(port) >> (irq & 7)) & 1; 852 return (inb(port) >> (irq & 7)) & 1;
853 } 853 }
@@ -1388,7 +1388,7 @@ static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq,
1388 } 1388 }
1389 1389
1390 ioapic_register_intr(irq, trigger); 1390 ioapic_register_intr(irq, trigger);
1391 if (irq < 16) 1391 if (irq < NR_IRQS_LEGACY)
1392 disable_8259A_irq(irq); 1392 disable_8259A_irq(irq);
1393 1393
1394 ioapic_write_entry(apic, pin, entry); 1394 ioapic_write_entry(apic, pin, entry);
@@ -2080,7 +2080,7 @@ static unsigned int startup_ioapic_irq(unsigned int irq)
2080 struct irq_cfg *cfg; 2080 struct irq_cfg *cfg;
2081 2081
2082 spin_lock_irqsave(&ioapic_lock, flags); 2082 spin_lock_irqsave(&ioapic_lock, flags);
2083 if (irq < 16) { 2083 if (irq < NR_IRQS_LEGACY) {
2084 disable_8259A_irq(irq); 2084 disable_8259A_irq(irq);
2085 if (i8259A_irq_pending(irq)) 2085 if (i8259A_irq_pending(irq))
2086 was_pending = 1; 2086 was_pending = 1;
@@ -2504,7 +2504,7 @@ static inline void init_IO_APIC_traps(void)
2504 * so default to an old-fashioned 8259 2504 * so default to an old-fashioned 8259
2505 * interrupt if we can.. 2505 * interrupt if we can..
2506 */ 2506 */
2507 if (irq < 16) 2507 if (irq < NR_IRQS_LEGACY)
2508 make_8259A_irq(irq); 2508 make_8259A_irq(irq);
2509 else 2509 else
2510 /* Strange. Oh, well.. */ 2510 /* Strange. Oh, well.. */
@@ -3794,7 +3794,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int p
3794 /* 3794 /*
3795 * IRQs < 16 are already in the irq_2_pin[] map 3795 * IRQs < 16 are already in the irq_2_pin[] map
3796 */ 3796 */
3797 if (irq >= 16) { 3797 if (irq >= NR_IRQS_LEGACY) {
3798 cfg = desc->chip_data; 3798 cfg = desc->chip_data;
3799 add_pin_to_irq_cpu(irq, cpu, ioapic, pin); 3799 add_pin_to_irq_cpu(irq, cpu, ioapic, pin);
3800 } 3800 }
diff --git a/arch/x86/kernel/irqinit_32.c b/arch/x86/kernel/irqinit_32.c
index 5a5651b7f9e6..6a92f47c52e7 100644
--- a/arch/x86/kernel/irqinit_32.c
+++ b/arch/x86/kernel/irqinit_32.c
@@ -68,7 +68,7 @@ void __init init_ISA_irqs (void)
68 /* 68 /*
69 * 16 old-style INTA-cycle interrupts: 69 * 16 old-style INTA-cycle interrupts:
70 */ 70 */
71 for (i = 0; i < 16; i++) { 71 for (i = 0; i < NR_IRQS_LEGACY; i++) {
72 struct irq_desc *desc = irq_to_desc(i); 72 struct irq_desc *desc = irq_to_desc(i);
73 73
74 desc->status = IRQ_DISABLED; 74 desc->status = IRQ_DISABLED;
diff --git a/arch/x86/kernel/irqinit_64.c b/arch/x86/kernel/irqinit_64.c
index cd9f42d028d9..40c1e62ec785 100644
--- a/arch/x86/kernel/irqinit_64.c
+++ b/arch/x86/kernel/irqinit_64.c
@@ -142,7 +142,7 @@ void __init init_ISA_irqs(void)
142 init_bsp_APIC(); 142 init_bsp_APIC();
143 init_8259A(0); 143 init_8259A(0);
144 144
145 for (i = 0; i < 16; i++) { 145 for (i = 0; i < NR_IRQS_LEGACY; i++) {
146 struct irq_desc *desc = irq_to_desc(i); 146 struct irq_desc *desc = irq_to_desc(i);
147 147
148 desc->status = IRQ_DISABLED; 148 desc->status = IRQ_DISABLED;
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 96ca203eb51b..8aa09547f5ef 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -117,8 +117,8 @@ static DEFINE_SPINLOCK(sparse_irq_lock);
117 117
118struct irq_desc *irq_desc_ptrs[NR_IRQS] __read_mostly; 118struct irq_desc *irq_desc_ptrs[NR_IRQS] __read_mostly;
119 119
120static struct irq_desc irq_desc_legacy[16] __cacheline_aligned_in_smp = { 120static struct irq_desc irq_desc_legacy[NR_IRQS_LEGACY] __cacheline_aligned_in_smp = {
121 [0 ... 15] = { 121 [0 ... NR_IRQS_LEGACY-1] = {
122 .irq = -1, 122 .irq = -1,
123 .status = IRQ_DISABLED, 123 .status = IRQ_DISABLED,
124 .chip = &no_irq_chip, 124 .chip = &no_irq_chip,
@@ -132,7 +132,7 @@ static struct irq_desc irq_desc_legacy[16] __cacheline_aligned_in_smp = {
132}; 132};
133 133
134/* FIXME: use bootmem alloc ...*/ 134/* FIXME: use bootmem alloc ...*/
135static unsigned int kstat_irqs_legacy[16][NR_CPUS]; 135static unsigned int kstat_irqs_legacy[NR_IRQS_LEGACY][NR_CPUS];
136 136
137void __init early_irq_init(void) 137void __init early_irq_init(void)
138{ 138{