diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-08-19 23:49:48 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-16 10:52:05 -0400 |
commit | 0799e432acfda879eaeef9622426bfa1434f3786 (patch) | |
tree | bc9a1d07438c52df08ab1e283ccd0a191b5fe05d | |
parent | 85c0f90978bf50596dbd23854648020f1f9b5bfd (diff) |
x86: use nr_irqs
also add first_free_entry and pin_map_size, which were NR_IRQS derived
constants.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/kernel/io_apic_32.c | 26 | ||||
-rw-r--r-- | arch/x86/kernel/io_apic_64.c | 33 | ||||
-rw-r--r-- | arch/x86/kernel/irq_32.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/irq_64.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/irqinit_32.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/irqinit_64.c | 2 | ||||
-rw-r--r-- | include/asm-x86/irq.h | 3 |
7 files changed, 44 insertions, 38 deletions
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c index e710289f673e..d382990244f0 100644 --- a/arch/x86/kernel/io_apic_32.c +++ b/arch/x86/kernel/io_apic_32.c | |||
@@ -70,6 +70,7 @@ int timer_through_8259 __initdata; | |||
70 | */ | 70 | */ |
71 | int sis_apic_bug = -1; | 71 | int sis_apic_bug = -1; |
72 | 72 | ||
73 | int first_free_entry = NR_IRQS; | ||
73 | /* | 74 | /* |
74 | * # of IRQ routing registers | 75 | * # of IRQ routing registers |
75 | */ | 76 | */ |
@@ -100,6 +101,8 @@ static int disable_timer_pin_1 __initdata; | |||
100 | #define MAX_PLUS_SHARED_IRQS NR_IRQS | 101 | #define MAX_PLUS_SHARED_IRQS NR_IRQS |
101 | #define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + NR_IRQS) | 102 | #define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + NR_IRQS) |
102 | 103 | ||
104 | int pin_map_size = PIN_MAP_SIZE; | ||
105 | |||
103 | /* | 106 | /* |
104 | * This is performance-critical, we want to do it O(1) | 107 | * This is performance-critical, we want to do it O(1) |
105 | * | 108 | * |
@@ -213,7 +216,6 @@ static void ioapic_mask_entry(int apic, int pin) | |||
213 | */ | 216 | */ |
214 | static void add_pin_to_irq(unsigned int irq, int apic, int pin) | 217 | static void add_pin_to_irq(unsigned int irq, int apic, int pin) |
215 | { | 218 | { |
216 | static int first_free_entry = NR_IRQS; | ||
217 | struct irq_pin_list *entry = irq_2_pin + irq; | 219 | struct irq_pin_list *entry = irq_2_pin + irq; |
218 | 220 | ||
219 | while (entry->next) | 221 | while (entry->next) |
@@ -222,7 +224,7 @@ static void add_pin_to_irq(unsigned int irq, int apic, int pin) | |||
222 | if (entry->pin != -1) { | 224 | if (entry->pin != -1) { |
223 | entry->next = first_free_entry; | 225 | entry->next = first_free_entry; |
224 | entry = irq_2_pin + entry->next; | 226 | entry = irq_2_pin + entry->next; |
225 | if (++first_free_entry >= PIN_MAP_SIZE) | 227 | if (++first_free_entry >= pin_map_size) |
226 | panic("io_apic.c: whoops"); | 228 | panic("io_apic.c: whoops"); |
227 | } | 229 | } |
228 | entry->apic = apic; | 230 | entry->apic = apic; |
@@ -457,7 +459,7 @@ static inline void rotate_irqs_among_cpus(unsigned long useful_load_threshold) | |||
457 | int i, j; | 459 | int i, j; |
458 | 460 | ||
459 | for_each_online_cpu(i) { | 461 | for_each_online_cpu(i) { |
460 | for (j = 0; j < NR_IRQS; j++) { | 462 | for (j = 0; j < nr_irqs; j++) { |
461 | if (!irq_desc[j].action) | 463 | if (!irq_desc[j].action) |
462 | continue; | 464 | continue; |
463 | /* Is it a significant load ? */ | 465 | /* Is it a significant load ? */ |
@@ -492,7 +494,7 @@ static void do_irq_balance(void) | |||
492 | if (!cpu_online(i)) | 494 | if (!cpu_online(i)) |
493 | continue; | 495 | continue; |
494 | package_index = CPU_TO_PACKAGEINDEX(i); | 496 | package_index = CPU_TO_PACKAGEINDEX(i); |
495 | for (j = 0; j < NR_IRQS; j++) { | 497 | for (j = 0; j < nr_irqs; j++) { |
496 | unsigned long value_now, delta; | 498 | unsigned long value_now, delta; |
497 | /* Is this an active IRQ or balancing disabled ? */ | 499 | /* Is this an active IRQ or balancing disabled ? */ |
498 | if (!irq_desc[j].action || irq_balancing_disabled(j)) | 500 | if (!irq_desc[j].action || irq_balancing_disabled(j)) |
@@ -587,7 +589,7 @@ tryanotherirq: | |||
587 | */ | 589 | */ |
588 | move_this_load = 0; | 590 | move_this_load = 0; |
589 | selected_irq = -1; | 591 | selected_irq = -1; |
590 | for (j = 0; j < NR_IRQS; j++) { | 592 | for (j = 0; j < nr_irqs; j++) { |
591 | /* Is this an active IRQ? */ | 593 | /* Is this an active IRQ? */ |
592 | if (!irq_desc[j].action) | 594 | if (!irq_desc[j].action) |
593 | continue; | 595 | continue; |
@@ -664,7 +666,7 @@ static int balanced_irq(void *unused) | |||
664 | long time_remaining = balanced_irq_interval; | 666 | long time_remaining = balanced_irq_interval; |
665 | 667 | ||
666 | /* push everything to CPU 0 to give us a starting point. */ | 668 | /* push everything to CPU 0 to give us a starting point. */ |
667 | for (i = 0 ; i < NR_IRQS ; i++) { | 669 | for (i = 0 ; i < nr_irqs ; i++) { |
668 | irq_desc[i].pending_mask = cpumask_of_cpu(0); | 670 | irq_desc[i].pending_mask = cpumask_of_cpu(0); |
669 | set_pending_irq(i, cpumask_of_cpu(0)); | 671 | set_pending_irq(i, cpumask_of_cpu(0)); |
670 | } | 672 | } |
@@ -712,8 +714,8 @@ static int __init balanced_irq_init(void) | |||
712 | physical_balance = 1; | 714 | physical_balance = 1; |
713 | 715 | ||
714 | for_each_online_cpu(i) { | 716 | for_each_online_cpu(i) { |
715 | irq_cpu_data[i].irq_delta = kzalloc(sizeof(unsigned long) * NR_IRQS, GFP_KERNEL); | 717 | irq_cpu_data[i].irq_delta = kzalloc(sizeof(unsigned long) * nr_irqs, GFP_KERNEL); |
716 | irq_cpu_data[i].last_irq = kzalloc(sizeof(unsigned long) * NR_IRQS, GFP_KERNEL); | 718 | irq_cpu_data[i].last_irq = kzalloc(sizeof(unsigned long) * nr_irqs, GFP_KERNEL); |
717 | if (irq_cpu_data[i].irq_delta == NULL || irq_cpu_data[i].last_irq == NULL) { | 719 | if (irq_cpu_data[i].irq_delta == NULL || irq_cpu_data[i].last_irq == NULL) { |
718 | printk(KERN_ERR "balanced_irq_init: out of memory"); | 720 | printk(KERN_ERR "balanced_irq_init: out of memory"); |
719 | goto failed; | 721 | goto failed; |
@@ -1441,7 +1443,7 @@ __apicdebuginit(void) print_IO_APIC(void) | |||
1441 | } | 1443 | } |
1442 | } | 1444 | } |
1443 | printk(KERN_DEBUG "IRQ to pin mappings:\n"); | 1445 | printk(KERN_DEBUG "IRQ to pin mappings:\n"); |
1444 | for (i = 0; i < NR_IRQS; i++) { | 1446 | for (i = 0; i < nr_irqs; i++) { |
1445 | struct irq_pin_list *entry = irq_2_pin + i; | 1447 | struct irq_pin_list *entry = irq_2_pin + i; |
1446 | if (entry->pin < 0) | 1448 | if (entry->pin < 0) |
1447 | continue; | 1449 | continue; |
@@ -1621,7 +1623,7 @@ static void __init enable_IO_APIC(void) | |||
1621 | int i, apic; | 1623 | int i, apic; |
1622 | unsigned long flags; | 1624 | unsigned long flags; |
1623 | 1625 | ||
1624 | for (i = 0; i < PIN_MAP_SIZE; i++) { | 1626 | for (i = 0; i < pin_map_size; i++) { |
1625 | irq_2_pin[i].pin = -1; | 1627 | irq_2_pin[i].pin = -1; |
1626 | irq_2_pin[i].next = 0; | 1628 | irq_2_pin[i].next = 0; |
1627 | } | 1629 | } |
@@ -2005,7 +2007,7 @@ static inline void init_IO_APIC_traps(void) | |||
2005 | * Also, we've got to be careful not to trash gate | 2007 | * Also, we've got to be careful not to trash gate |
2006 | * 0x80, because int 0x80 is hm, kind of importantish. ;) | 2008 | * 0x80, because int 0x80 is hm, kind of importantish. ;) |
2007 | */ | 2009 | */ |
2008 | for (irq = 0; irq < NR_IRQS ; irq++) { | 2010 | for (irq = 0; irq < nr_irqs ; irq++) { |
2009 | if (IO_APIC_IRQ(irq) && !irq_vector[irq]) { | 2011 | if (IO_APIC_IRQ(irq) && !irq_vector[irq]) { |
2010 | /* | 2012 | /* |
2011 | * Hmm.. We don't have an entry for this, | 2013 | * Hmm.. We don't have an entry for this, |
@@ -2449,7 +2451,7 @@ int create_irq(void) | |||
2449 | 2451 | ||
2450 | irq = -ENOSPC; | 2452 | irq = -ENOSPC; |
2451 | spin_lock_irqsave(&vector_lock, flags); | 2453 | spin_lock_irqsave(&vector_lock, flags); |
2452 | for (new = (NR_IRQS - 1); new >= 0; new--) { | 2454 | for (new = (nr_irqs - 1); new >= 0; new--) { |
2453 | if (platform_legacy_irq(new)) | 2455 | if (platform_legacy_irq(new)) |
2454 | continue; | 2456 | continue; |
2455 | if (irq_vector[new] != 0) | 2457 | if (irq_vector[new] != 0) |
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c index 02063ae042f7..448384c7c1e8 100644 --- a/arch/x86/kernel/io_apic_64.c +++ b/arch/x86/kernel/io_apic_64.c | |||
@@ -132,6 +132,7 @@ DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES); | |||
132 | #define MAX_PLUS_SHARED_IRQS NR_IRQS | 132 | #define MAX_PLUS_SHARED_IRQS NR_IRQS |
133 | #define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + NR_IRQS) | 133 | #define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + NR_IRQS) |
134 | 134 | ||
135 | int pin_map_size = PIN_MAP_SIZE; | ||
135 | /* | 136 | /* |
136 | * This is performance-critical, we want to do it O(1) | 137 | * This is performance-critical, we want to do it O(1) |
137 | * | 138 | * |
@@ -224,7 +225,7 @@ static inline void io_apic_sync(unsigned int apic) | |||
224 | int pin; \ | 225 | int pin; \ |
225 | struct irq_pin_list *entry = irq_2_pin + irq; \ | 226 | struct irq_pin_list *entry = irq_2_pin + irq; \ |
226 | \ | 227 | \ |
227 | BUG_ON(irq >= NR_IRQS); \ | 228 | BUG_ON(irq >= nr_irqs); \ |
228 | for (;;) { \ | 229 | for (;;) { \ |
229 | unsigned int reg; \ | 230 | unsigned int reg; \ |
230 | pin = entry->pin; \ | 231 | pin = entry->pin; \ |
@@ -301,7 +302,7 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector) | |||
301 | int apic, pin; | 302 | int apic, pin; |
302 | struct irq_pin_list *entry = irq_2_pin + irq; | 303 | struct irq_pin_list *entry = irq_2_pin + irq; |
303 | 304 | ||
304 | BUG_ON(irq >= NR_IRQS); | 305 | BUG_ON(irq >= nr_irqs); |
305 | for (;;) { | 306 | for (;;) { |
306 | unsigned int reg; | 307 | unsigned int reg; |
307 | apic = entry->apic; | 308 | apic = entry->apic; |
@@ -358,19 +359,19 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask) | |||
358 | * shared ISA-space IRQs, so we have to support them. We are super | 359 | * shared ISA-space IRQs, so we have to support them. We are super |
359 | * fast in the common case, and fast for shared ISA-space IRQs. | 360 | * fast in the common case, and fast for shared ISA-space IRQs. |
360 | */ | 361 | */ |
362 | int first_free_entry = NR_IRQS; | ||
361 | static void add_pin_to_irq(unsigned int irq, int apic, int pin) | 363 | static void add_pin_to_irq(unsigned int irq, int apic, int pin) |
362 | { | 364 | { |
363 | static int first_free_entry = NR_IRQS; | ||
364 | struct irq_pin_list *entry = irq_2_pin + irq; | 365 | struct irq_pin_list *entry = irq_2_pin + irq; |
365 | 366 | ||
366 | BUG_ON(irq >= NR_IRQS); | 367 | BUG_ON(irq >= nr_irqs); |
367 | while (entry->next) | 368 | while (entry->next) |
368 | entry = irq_2_pin + entry->next; | 369 | entry = irq_2_pin + entry->next; |
369 | 370 | ||
370 | if (entry->pin != -1) { | 371 | if (entry->pin != -1) { |
371 | entry->next = first_free_entry; | 372 | entry->next = first_free_entry; |
372 | entry = irq_2_pin + entry->next; | 373 | entry = irq_2_pin + entry->next; |
373 | if (++first_free_entry >= PIN_MAP_SIZE) | 374 | if (++first_free_entry >= pin_map_size) |
374 | panic("io_apic.c: ran out of irq_2_pin entries!"); | 375 | panic("io_apic.c: ran out of irq_2_pin entries!"); |
375 | } | 376 | } |
376 | entry->apic = apic; | 377 | entry->apic = apic; |
@@ -634,7 +635,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin) | |||
634 | best_guess = irq; | 635 | best_guess = irq; |
635 | } | 636 | } |
636 | } | 637 | } |
637 | BUG_ON(best_guess >= NR_IRQS); | 638 | BUG_ON(best_guess >= nr_irqs); |
638 | return best_guess; | 639 | return best_guess; |
639 | } | 640 | } |
640 | 641 | ||
@@ -766,7 +767,7 @@ static int pin_2_irq(int idx, int apic, int pin) | |||
766 | irq += nr_ioapic_registers[i++]; | 767 | irq += nr_ioapic_registers[i++]; |
767 | irq += pin; | 768 | irq += pin; |
768 | } | 769 | } |
769 | BUG_ON(irq >= NR_IRQS); | 770 | BUG_ON(irq >= nr_irqs); |
770 | return irq; | 771 | return irq; |
771 | } | 772 | } |
772 | 773 | ||
@@ -801,7 +802,7 @@ static int __assign_irq_vector(int irq, cpumask_t mask) | |||
801 | int cpu; | 802 | int cpu; |
802 | struct irq_cfg *cfg; | 803 | struct irq_cfg *cfg; |
803 | 804 | ||
804 | BUG_ON((unsigned)irq >= NR_IRQS); | 805 | BUG_ON((unsigned)irq >= nr_irqs); |
805 | cfg = &irq_cfg[irq]; | 806 | cfg = &irq_cfg[irq]; |
806 | 807 | ||
807 | /* Only try and allocate irqs on cpus that are present */ | 808 | /* Only try and allocate irqs on cpus that are present */ |
@@ -875,7 +876,7 @@ static void __clear_irq_vector(int irq) | |||
875 | cpumask_t mask; | 876 | cpumask_t mask; |
876 | int cpu, vector; | 877 | int cpu, vector; |
877 | 878 | ||
878 | BUG_ON((unsigned)irq >= NR_IRQS); | 879 | BUG_ON((unsigned)irq >= nr_irqs); |
879 | cfg = &irq_cfg[irq]; | 880 | cfg = &irq_cfg[irq]; |
880 | BUG_ON(!cfg->vector); | 881 | BUG_ON(!cfg->vector); |
881 | 882 | ||
@@ -895,7 +896,7 @@ void __setup_vector_irq(int cpu) | |||
895 | int irq, vector; | 896 | int irq, vector; |
896 | 897 | ||
897 | /* Mark the inuse vectors */ | 898 | /* Mark the inuse vectors */ |
898 | for (irq = 0; irq < NR_IRQS; ++irq) { | 899 | for (irq = 0; irq < nr_irqs; ++irq) { |
899 | if (!cpu_isset(cpu, irq_cfg[irq].domain)) | 900 | if (!cpu_isset(cpu, irq_cfg[irq].domain)) |
900 | continue; | 901 | continue; |
901 | vector = irq_cfg[irq].vector; | 902 | vector = irq_cfg[irq].vector; |
@@ -1193,7 +1194,7 @@ __apicdebuginit(void) print_IO_APIC(void) | |||
1193 | } | 1194 | } |
1194 | } | 1195 | } |
1195 | printk(KERN_DEBUG "IRQ to pin mappings:\n"); | 1196 | printk(KERN_DEBUG "IRQ to pin mappings:\n"); |
1196 | for (i = 0; i < NR_IRQS; i++) { | 1197 | for (i = 0; i < nr_irqs; i++) { |
1197 | struct irq_pin_list *entry = irq_2_pin + i; | 1198 | struct irq_pin_list *entry = irq_2_pin + i; |
1198 | if (entry->pin < 0) | 1199 | if (entry->pin < 0) |
1199 | continue; | 1200 | continue; |
@@ -1366,7 +1367,7 @@ void __init enable_IO_APIC(void) | |||
1366 | int i, apic; | 1367 | int i, apic; |
1367 | unsigned long flags; | 1368 | unsigned long flags; |
1368 | 1369 | ||
1369 | for (i = 0; i < PIN_MAP_SIZE; i++) { | 1370 | for (i = 0; i < pin_map_size; i++) { |
1370 | irq_2_pin[i].pin = -1; | 1371 | irq_2_pin[i].pin = -1; |
1371 | irq_2_pin[i].next = 0; | 1372 | irq_2_pin[i].next = 0; |
1372 | } | 1373 | } |
@@ -1658,7 +1659,7 @@ static void ir_irq_migration(struct work_struct *work) | |||
1658 | { | 1659 | { |
1659 | int irq; | 1660 | int irq; |
1660 | 1661 | ||
1661 | for (irq = 0; irq < NR_IRQS; irq++) { | 1662 | for (irq = 0; irq < nr_irqs; irq++) { |
1662 | struct irq_desc *desc = irq_desc + irq; | 1663 | struct irq_desc *desc = irq_desc + irq; |
1663 | if (desc->status & IRQ_MOVE_PENDING) { | 1664 | if (desc->status & IRQ_MOVE_PENDING) { |
1664 | unsigned long flags; | 1665 | unsigned long flags; |
@@ -1707,7 +1708,7 @@ asmlinkage void smp_irq_move_cleanup_interrupt(void) | |||
1707 | struct irq_desc *desc; | 1708 | struct irq_desc *desc; |
1708 | struct irq_cfg *cfg; | 1709 | struct irq_cfg *cfg; |
1709 | irq = __get_cpu_var(vector_irq)[vector]; | 1710 | irq = __get_cpu_var(vector_irq)[vector]; |
1710 | if (irq >= NR_IRQS) | 1711 | if (irq >= nr_irqs) |
1711 | continue; | 1712 | continue; |
1712 | 1713 | ||
1713 | desc = irq_desc + irq; | 1714 | desc = irq_desc + irq; |
@@ -1865,7 +1866,7 @@ static inline void init_IO_APIC_traps(void) | |||
1865 | * Also, we've got to be careful not to trash gate | 1866 | * Also, we've got to be careful not to trash gate |
1866 | * 0x80, because int 0x80 is hm, kind of importantish. ;) | 1867 | * 0x80, because int 0x80 is hm, kind of importantish. ;) |
1867 | */ | 1868 | */ |
1868 | for (irq = 0; irq < NR_IRQS ; irq++) { | 1869 | for (irq = 0; irq < nr_irqs ; irq++) { |
1869 | if (IO_APIC_IRQ(irq) && !irq_cfg[irq].vector) { | 1870 | if (IO_APIC_IRQ(irq) && !irq_cfg[irq].vector) { |
1870 | /* | 1871 | /* |
1871 | * Hmm.. We don't have an entry for this, | 1872 | * Hmm.. We don't have an entry for this, |
@@ -2279,7 +2280,7 @@ int create_irq(void) | |||
2279 | 2280 | ||
2280 | irq = -ENOSPC; | 2281 | irq = -ENOSPC; |
2281 | spin_lock_irqsave(&vector_lock, flags); | 2282 | spin_lock_irqsave(&vector_lock, flags); |
2282 | for (new = (NR_IRQS - 1); new >= 0; new--) { | 2283 | for (new = (nr_irqs - 1); new >= 0; new--) { |
2283 | if (platform_legacy_irq(new)) | 2284 | if (platform_legacy_irq(new)) |
2284 | continue; | 2285 | continue; |
2285 | if (irq_cfg[new].vector != 0) | 2286 | if (irq_cfg[new].vector != 0) |
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c index b71e02d42f4f..4c7ffb32854c 100644 --- a/arch/x86/kernel/irq_32.c +++ b/arch/x86/kernel/irq_32.c | |||
@@ -226,7 +226,7 @@ unsigned int do_IRQ(struct pt_regs *regs) | |||
226 | int overflow, irq = ~regs->orig_ax; | 226 | int overflow, irq = ~regs->orig_ax; |
227 | struct irq_desc *desc = irq_desc + irq; | 227 | struct irq_desc *desc = irq_desc + irq; |
228 | 228 | ||
229 | if (unlikely((unsigned)irq >= NR_IRQS)) { | 229 | if (unlikely((unsigned)irq >= nr_irqs)) { |
230 | printk(KERN_EMERG "%s: cannot handle IRQ %d\n", | 230 | printk(KERN_EMERG "%s: cannot handle IRQ %d\n", |
231 | __func__, irq); | 231 | __func__, irq); |
232 | BUG(); | 232 | BUG(); |
@@ -271,7 +271,7 @@ int show_interrupts(struct seq_file *p, void *v) | |||
271 | seq_putc(p, '\n'); | 271 | seq_putc(p, '\n'); |
272 | } | 272 | } |
273 | 273 | ||
274 | if (i < NR_IRQS) { | 274 | if (i < nr_irqs) { |
275 | unsigned any_count = 0; | 275 | unsigned any_count = 0; |
276 | 276 | ||
277 | spin_lock_irqsave(&irq_desc[i].lock, flags); | 277 | spin_lock_irqsave(&irq_desc[i].lock, flags); |
@@ -303,7 +303,7 @@ int show_interrupts(struct seq_file *p, void *v) | |||
303 | seq_putc(p, '\n'); | 303 | seq_putc(p, '\n'); |
304 | skip: | 304 | skip: |
305 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | 305 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); |
306 | } else if (i == NR_IRQS) { | 306 | } else if (i == nr_irqs) { |
307 | seq_printf(p, "NMI: "); | 307 | seq_printf(p, "NMI: "); |
308 | for_each_online_cpu(j) | 308 | for_each_online_cpu(j) |
309 | seq_printf(p, "%10u ", nmi_count(j)); | 309 | seq_printf(p, "%10u ", nmi_count(j)); |
@@ -396,7 +396,7 @@ void fixup_irqs(cpumask_t map) | |||
396 | unsigned int irq; | 396 | unsigned int irq; |
397 | static int warned; | 397 | static int warned; |
398 | 398 | ||
399 | for (irq = 0; irq < NR_IRQS; irq++) { | 399 | for (irq = 0; irq < nr_irqs; irq++) { |
400 | cpumask_t mask; | 400 | cpumask_t mask; |
401 | if (irq == 2) | 401 | if (irq == 2) |
402 | continue; | 402 | continue; |
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c index f065fe9071b9..e1f0839430d2 100644 --- a/arch/x86/kernel/irq_64.c +++ b/arch/x86/kernel/irq_64.c | |||
@@ -81,7 +81,7 @@ int show_interrupts(struct seq_file *p, void *v) | |||
81 | seq_putc(p, '\n'); | 81 | seq_putc(p, '\n'); |
82 | } | 82 | } |
83 | 83 | ||
84 | if (i < NR_IRQS) { | 84 | if (i < nr_irqs) { |
85 | unsigned any_count = 0; | 85 | unsigned any_count = 0; |
86 | 86 | ||
87 | spin_lock_irqsave(&irq_desc[i].lock, flags); | 87 | spin_lock_irqsave(&irq_desc[i].lock, flags); |
@@ -112,7 +112,7 @@ int show_interrupts(struct seq_file *p, void *v) | |||
112 | seq_putc(p, '\n'); | 112 | seq_putc(p, '\n'); |
113 | skip: | 113 | skip: |
114 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | 114 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); |
115 | } else if (i == NR_IRQS) { | 115 | } else if (i == nr_irqs) { |
116 | seq_printf(p, "NMI: "); | 116 | seq_printf(p, "NMI: "); |
117 | for_each_online_cpu(j) | 117 | for_each_online_cpu(j) |
118 | seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count); | 118 | seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count); |
@@ -201,7 +201,7 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs) | |||
201 | stack_overflow_check(regs); | 201 | stack_overflow_check(regs); |
202 | #endif | 202 | #endif |
203 | 203 | ||
204 | if (likely(irq < NR_IRQS)) | 204 | if (likely(irq < nr_irqs)) |
205 | generic_handle_irq(irq); | 205 | generic_handle_irq(irq); |
206 | else { | 206 | else { |
207 | if (!disable_apic) | 207 | if (!disable_apic) |
@@ -224,7 +224,7 @@ void fixup_irqs(cpumask_t map) | |||
224 | unsigned int irq; | 224 | unsigned int irq; |
225 | static int warned; | 225 | static int warned; |
226 | 226 | ||
227 | for (irq = 0; irq < NR_IRQS; irq++) { | 227 | for (irq = 0; irq < nr_irqs; irq++) { |
228 | cpumask_t mask; | 228 | cpumask_t mask; |
229 | int break_affinity = 0; | 229 | int break_affinity = 0; |
230 | int set_affinity = 1; | 230 | int set_affinity = 1; |
diff --git a/arch/x86/kernel/irqinit_32.c b/arch/x86/kernel/irqinit_32.c index 9200a1e2752d..65c1c9507707 100644 --- a/arch/x86/kernel/irqinit_32.c +++ b/arch/x86/kernel/irqinit_32.c | |||
@@ -100,7 +100,7 @@ void __init native_init_IRQ(void) | |||
100 | */ | 100 | */ |
101 | for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) { | 101 | for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) { |
102 | int vector = FIRST_EXTERNAL_VECTOR + i; | 102 | int vector = FIRST_EXTERNAL_VECTOR + i; |
103 | if (i >= NR_IRQS) | 103 | if (i >= nr_irqs) |
104 | break; | 104 | break; |
105 | /* SYSCALL_VECTOR was reserved in trap_init. */ | 105 | /* SYSCALL_VECTOR was reserved in trap_init. */ |
106 | if (!test_bit(vector, used_vectors)) | 106 | if (!test_bit(vector, used_vectors)) |
diff --git a/arch/x86/kernel/irqinit_64.c b/arch/x86/kernel/irqinit_64.c index 5b5be9d43c2a..165c5d9b0d1a 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 < NR_IRQS; i++) { | 145 | for (i = 0; i < nr_irqs; i++) { |
146 | irq_desc[i].status = IRQ_DISABLED; | 146 | irq_desc[i].status = IRQ_DISABLED; |
147 | irq_desc[i].action = NULL; | 147 | irq_desc[i].action = NULL; |
148 | irq_desc[i].depth = 1; | 148 | irq_desc[i].depth = 1; |
diff --git a/include/asm-x86/irq.h b/include/asm-x86/irq.h index 1e5f2909c1db..2a130c44f5de 100644 --- a/include/asm-x86/irq.h +++ b/include/asm-x86/irq.h | |||
@@ -10,6 +10,9 @@ | |||
10 | #include <asm/apicdef.h> | 10 | #include <asm/apicdef.h> |
11 | #include <asm/irq_vectors.h> | 11 | #include <asm/irq_vectors.h> |
12 | 12 | ||
13 | extern int pin_map_size; | ||
14 | extern int first_free_entry; | ||
15 | |||
13 | static inline int irq_canonicalize(int irq) | 16 | static inline int irq_canonicalize(int irq) |
14 | { | 17 | { |
15 | return ((irq == 2) ? 9 : irq); | 18 | return ((irq == 2) ? 9 : irq); |