aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-20 16:22:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-20 16:23:01 -0400
commit9301975ec251bab1ad7cfcb84a688b26187e4e4a (patch)
tree91e48be0bdc67cbcb75bc8a299a3dcf168e0a814 /drivers
parent7110879cf2afbfb7af79675f5ff109e63d631c25 (diff)
parentdd3a1db900f2a215a7d7dd71b836e149a6cf5fed (diff)
Merge branch 'genirq-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
This merges branches irq/genirq, irq/sparseirq-v4, timers/hpet-percpu and x86/uv. The sparseirq branch is just preliminary groundwork: no sparse IRQs are actually implemented by this tree anymore - just the new APIs are added while keeping the old way intact as well (the new APIs map 1:1 to irq_desc[]). The 'real' sparse IRQ support will then be a relatively small patch ontop of this - with a v2.6.29 merge target. * 'genirq-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (178 commits) genirq: improve include files intr_remapping: fix typo io_apic: make irq_mis_count available on 64-bit too genirq: fix name space collisions of nr_irqs in arch/* genirq: fix name space collision of nr_irqs in autoprobe.c genirq: use iterators for irq_desc loops proc: fixup irq iterator genirq: add reverse iterator for irq_desc x86: move ack_bad_irq() to irq.c x86: unify show_interrupts() and proc helpers x86: cleanup show_interrupts genirq: cleanup the sparseirq modifications genirq: remove artifacts from sparseirq removal genirq: revert dynarray genirq: remove irq_to_desc_alloc genirq: remove sparse irq code genirq: use inline function for irq_to_desc genirq: consolidate nr_irqs and for_each_irq_desc() x86: remove sparse irq from Kconfig genirq: define nr_irqs for architectures with GENERIC_HARDIRQS=n ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/hpet.c2
-rw-r--r--drivers/char/random.c36
-rw-r--r--drivers/char/vr41xx_giu.c2
-rw-r--r--drivers/gpio/gpiolib.c2
-rw-r--r--drivers/mfd/asic3.c4
-rw-r--r--drivers/mfd/htc-egpio.c2
-rw-r--r--drivers/net/3c59x.c4
-rw-r--r--drivers/net/hamradio/baycom_ser_fdx.c4
-rw-r--r--drivers/net/hamradio/scc.c6
-rw-r--r--drivers/net/wan/sbni.c2
-rw-r--r--drivers/parisc/dino.c6
-rw-r--r--drivers/parisc/eisa.c4
-rw-r--r--drivers/parisc/gsc.c12
-rw-r--r--drivers/parisc/iosapic.c4
-rw-r--r--drivers/parisc/superio.c4
-rw-r--r--drivers/pci/dmar.c61
-rw-r--r--drivers/pci/htirq.c3
-rw-r--r--drivers/pci/intr_remapping.c139
-rw-r--r--drivers/pcmcia/at91_cf.c2
-rw-r--r--drivers/pcmcia/hd64465_ss.c12
-rw-r--r--drivers/pcmcia/vrc4171_card.c2
-rw-r--r--drivers/rtc/rtc-vr41xx.c4
-rw-r--r--drivers/scsi/aha152x.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h2
-rw-r--r--drivers/serial/68328serial.c11
-rw-r--r--drivers/serial/8250.c69
-rw-r--r--drivers/serial/amba-pl010.c2
-rw-r--r--drivers/serial/amba-pl011.c2
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_core.c2
-rw-r--r--drivers/serial/m32r_sio.c4
-rw-r--r--drivers/serial/serial_core.c2
-rw-r--r--drivers/serial/serial_lh7a40x.c2
-rw-r--r--drivers/serial/sh-sci.c2
-rw-r--r--drivers/serial/ucc_uart.c2
-rw-r--r--drivers/xen/events.c18
35 files changed, 283 insertions, 154 deletions
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index f3cfb4c76125..408f5f92cb4e 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -219,7 +219,7 @@ static void hpet_timer_set_irq(struct hpet_dev *devp)
219 for (irq = find_first_bit(&v, HPET_MAX_IRQ); irq < HPET_MAX_IRQ; 219 for (irq = find_first_bit(&v, HPET_MAX_IRQ); irq < HPET_MAX_IRQ;
220 irq = find_next_bit(&v, HPET_MAX_IRQ, 1 + irq)) { 220 irq = find_next_bit(&v, HPET_MAX_IRQ, 1 + irq)) {
221 221
222 if (irq >= NR_IRQS) { 222 if (irq >= nr_irqs) {
223 irq = HPET_MAX_IRQ; 223 irq = HPET_MAX_IRQ;
224 break; 224 break;
225 } 225 }
diff --git a/drivers/char/random.c b/drivers/char/random.c
index c8752eaad483..705a839f1796 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -558,9 +558,26 @@ struct timer_rand_state {
558 unsigned dont_count_entropy:1; 558 unsigned dont_count_entropy:1;
559}; 559};
560 560
561static struct timer_rand_state input_timer_state;
562static struct timer_rand_state *irq_timer_state[NR_IRQS]; 561static struct timer_rand_state *irq_timer_state[NR_IRQS];
563 562
563static struct timer_rand_state *get_timer_rand_state(unsigned int irq)
564{
565 if (irq >= nr_irqs)
566 return NULL;
567
568 return irq_timer_state[irq];
569}
570
571static void set_timer_rand_state(unsigned int irq, struct timer_rand_state *state)
572{
573 if (irq >= nr_irqs)
574 return;
575
576 irq_timer_state[irq] = state;
577}
578
579static struct timer_rand_state input_timer_state;
580
564/* 581/*
565 * This function adds entropy to the entropy "pool" by using timing 582 * This function adds entropy to the entropy "pool" by using timing
566 * delays. It uses the timer_rand_state structure to make an estimate 583 * delays. It uses the timer_rand_state structure to make an estimate
@@ -648,11 +665,15 @@ EXPORT_SYMBOL_GPL(add_input_randomness);
648 665
649void add_interrupt_randomness(int irq) 666void add_interrupt_randomness(int irq)
650{ 667{
651 if (irq >= NR_IRQS || irq_timer_state[irq] == NULL) 668 struct timer_rand_state *state;
669
670 state = get_timer_rand_state(irq);
671
672 if (state == NULL)
652 return; 673 return;
653 674
654 DEBUG_ENT("irq event %d\n", irq); 675 DEBUG_ENT("irq event %d\n", irq);
655 add_timer_randomness(irq_timer_state[irq], 0x100 + irq); 676 add_timer_randomness(state, 0x100 + irq);
656} 677}
657 678
658#ifdef CONFIG_BLOCK 679#ifdef CONFIG_BLOCK
@@ -912,7 +933,12 @@ void rand_initialize_irq(int irq)
912{ 933{
913 struct timer_rand_state *state; 934 struct timer_rand_state *state;
914 935
915 if (irq >= NR_IRQS || irq_timer_state[irq]) 936 if (irq >= nr_irqs)
937 return;
938
939 state = get_timer_rand_state(irq);
940
941 if (state)
916 return; 942 return;
917 943
918 /* 944 /*
@@ -921,7 +947,7 @@ void rand_initialize_irq(int irq)
921 */ 947 */
922 state = kzalloc(sizeof(struct timer_rand_state), GFP_KERNEL); 948 state = kzalloc(sizeof(struct timer_rand_state), GFP_KERNEL);
923 if (state) 949 if (state)
924 irq_timer_state[irq] = state; 950 set_timer_rand_state(irq, state);
925} 951}
926 952
927#ifdef CONFIG_BLOCK 953#ifdef CONFIG_BLOCK
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c
index ffe9b4e3072e..54c837288d19 100644
--- a/drivers/char/vr41xx_giu.c
+++ b/drivers/char/vr41xx_giu.c
@@ -641,7 +641,7 @@ static int __devinit giu_probe(struct platform_device *dev)
641 } 641 }
642 642
643 irq = platform_get_irq(dev, 0); 643 irq = platform_get_irq(dev, 0);
644 if (irq < 0 || irq >= NR_IRQS) 644 if (irq < 0 || irq >= nr_irqs)
645 return -EBUSY; 645 return -EBUSY;
646 646
647 return cascade_irq(irq, giu_get_irq); 647 return cascade_irq(irq, giu_get_irq);
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 22edc4273ef6..faa1cc66e9cf 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1143,7 +1143,7 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)
1143 1143
1144 if (!is_out) { 1144 if (!is_out) {
1145 int irq = gpio_to_irq(gpio); 1145 int irq = gpio_to_irq(gpio);
1146 struct irq_desc *desc = irq_desc + irq; 1146 struct irq_desc *desc = irq_to_desc(irq);
1147 1147
1148 /* This races with request_irq(), set_irq_type(), 1148 /* This races with request_irq(), set_irq_type(),
1149 * and set_irq_wake() ... but those are "rare". 1149 * and set_irq_wake() ... but those are "rare".
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index ba5aa2008273..e4c0db4dc7b1 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -123,7 +123,7 @@ static void asic3_irq_demux(unsigned int irq, struct irq_desc *desc)
123 irqnr = asic->irq_base + 123 irqnr = asic->irq_base +
124 (ASIC3_GPIOS_PER_BANK * bank) 124 (ASIC3_GPIOS_PER_BANK * bank)
125 + i; 125 + i;
126 desc = irq_desc + irqnr; 126 desc = irq_to_desc(irqnr);
127 desc->handle_irq(irqnr, desc); 127 desc->handle_irq(irqnr, desc);
128 if (asic->irq_bothedge[bank] & bit) 128 if (asic->irq_bothedge[bank] & bit)
129 asic3_irq_flip_edge(asic, base, 129 asic3_irq_flip_edge(asic, base,
@@ -136,7 +136,7 @@ static void asic3_irq_demux(unsigned int irq, struct irq_desc *desc)
136 for (i = ASIC3_NUM_GPIOS; i < ASIC3_NR_IRQS; i++) { 136 for (i = ASIC3_NUM_GPIOS; i < ASIC3_NR_IRQS; i++) {
137 /* They start at bit 4 and go up */ 137 /* They start at bit 4 and go up */
138 if (status & (1 << (i - ASIC3_NUM_GPIOS + 4))) { 138 if (status & (1 << (i - ASIC3_NUM_GPIOS + 4))) {
139 desc = irq_desc + asic->irq_base + i; 139 desc = irq_to_desc(asic->irq_base + i);
140 desc->handle_irq(asic->irq_base + i, 140 desc->handle_irq(asic->irq_base + i,
141 desc); 141 desc);
142 } 142 }
diff --git a/drivers/mfd/htc-egpio.c b/drivers/mfd/htc-egpio.c
index 50dff6e0088d..1a4d04664d6d 100644
--- a/drivers/mfd/htc-egpio.c
+++ b/drivers/mfd/htc-egpio.c
@@ -112,7 +112,7 @@ static void egpio_handler(unsigned int irq, struct irq_desc *desc)
112 /* Run irq handler */ 112 /* Run irq handler */
113 pr_debug("got IRQ %d\n", irqpin); 113 pr_debug("got IRQ %d\n", irqpin);
114 irq = ei->irq_start + irqpin; 114 irq = ei->irq_start + irqpin;
115 desc = &irq_desc[irq]; 115 desc = irq_to_desc(irq);
116 desc->handle_irq(irq, desc); 116 desc->handle_irq(irq, desc);
117 } 117 }
118} 118}
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 491ee16da5c1..9ba295d9dd97 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -90,7 +90,7 @@ static int vortex_debug = 1;
90#include <linux/eisa.h> 90#include <linux/eisa.h>
91#include <linux/bitops.h> 91#include <linux/bitops.h>
92#include <linux/jiffies.h> 92#include <linux/jiffies.h>
93#include <asm/irq.h> /* For NR_IRQS only. */ 93#include <asm/irq.h> /* For nr_irqs only. */
94#include <asm/io.h> 94#include <asm/io.h>
95#include <asm/uaccess.h> 95#include <asm/uaccess.h>
96 96
@@ -1221,7 +1221,7 @@ static int __devinit vortex_probe1(struct device *gendev,
1221 if (print_info) 1221 if (print_info)
1222 printk(", IRQ %d\n", dev->irq); 1222 printk(", IRQ %d\n", dev->irq);
1223 /* Tell them about an invalid IRQ. */ 1223 /* Tell them about an invalid IRQ. */
1224 if (dev->irq <= 0 || dev->irq >= NR_IRQS) 1224 if (dev->irq <= 0 || dev->irq >= nr_irqs)
1225 printk(KERN_WARNING " *** Warning: IRQ %d is unlikely to work! ***\n", 1225 printk(KERN_WARNING " *** Warning: IRQ %d is unlikely to work! ***\n",
1226 dev->irq); 1226 dev->irq);
1227 1227
diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c
index 17ac6975d70d..b6a816e60c0f 100644
--- a/drivers/net/hamradio/baycom_ser_fdx.c
+++ b/drivers/net/hamradio/baycom_ser_fdx.c
@@ -416,10 +416,10 @@ static int ser12_open(struct net_device *dev)
416 if (!dev || !bc) 416 if (!dev || !bc)
417 return -ENXIO; 417 return -ENXIO;
418 if (!dev->base_addr || dev->base_addr > 0xffff-SER12_EXTENT || 418 if (!dev->base_addr || dev->base_addr > 0xffff-SER12_EXTENT ||
419 dev->irq < 2 || dev->irq > NR_IRQS) { 419 dev->irq < 2 || dev->irq > nr_irqs) {
420 printk(KERN_INFO "baycom_ser_fdx: invalid portnumber (max %u) " 420 printk(KERN_INFO "baycom_ser_fdx: invalid portnumber (max %u) "
421 "or irq (2 <= irq <= %d)\n", 421 "or irq (2 <= irq <= %d)\n",
422 0xffff-SER12_EXTENT, NR_IRQS); 422 0xffff-SER12_EXTENT, nr_irqs);
423 return -ENXIO; 423 return -ENXIO;
424 } 424 }
425 if (bc->baud < 300 || bc->baud > 4800) { 425 if (bc->baud < 300 || bc->baud > 4800) {
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index 45ae9d1191d7..c17e39bc5460 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -1465,7 +1465,7 @@ static void z8530_init(void)
1465 printk(KERN_INFO "Init Z8530 driver: %u channels, IRQ", Nchips*2); 1465 printk(KERN_INFO "Init Z8530 driver: %u channels, IRQ", Nchips*2);
1466 1466
1467 flag=" "; 1467 flag=" ";
1468 for (k = 0; k < NR_IRQS; k++) 1468 for (k = 0; k < nr_irqs; k++)
1469 if (Ivec[k].used) 1469 if (Ivec[k].used)
1470 { 1470 {
1471 printk("%s%d", flag, k); 1471 printk("%s%d", flag, k);
@@ -1728,7 +1728,7 @@ static int scc_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1728 1728
1729 if (hwcfg.irq == 2) hwcfg.irq = 9; 1729 if (hwcfg.irq == 2) hwcfg.irq = 9;
1730 1730
1731 if (hwcfg.irq < 0 || hwcfg.irq >= NR_IRQS) 1731 if (hwcfg.irq < 0 || hwcfg.irq >= nr_irqs)
1732 return -EINVAL; 1732 return -EINVAL;
1733 1733
1734 if (!Ivec[hwcfg.irq].used && hwcfg.irq) 1734 if (!Ivec[hwcfg.irq].used && hwcfg.irq)
@@ -2148,7 +2148,7 @@ static void __exit scc_cleanup_driver(void)
2148 } 2148 }
2149 2149
2150 /* To unload the port must be closed so no real IRQ pending */ 2150 /* To unload the port must be closed so no real IRQ pending */
2151 for (k=0; k < NR_IRQS ; k++) 2151 for (k = 0; k < nr_irqs ; k++)
2152 if (Ivec[k].used) free_irq(k, NULL); 2152 if (Ivec[k].used) free_irq(k, NULL);
2153 2153
2154 local_irq_enable(); 2154 local_irq_enable();
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index f972fef87c98..ee51b6a5e605 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -318,7 +318,7 @@ sbni_pci_probe( struct net_device *dev )
318 continue; 318 continue;
319 } 319 }
320 320
321 if( pci_irq_line <= 0 || pci_irq_line >= NR_IRQS ) 321 if (pci_irq_line <= 0 || pci_irq_line >= nr_irqs)
322 printk( KERN_WARNING " WARNING: The PCI BIOS assigned " 322 printk( KERN_WARNING " WARNING: The PCI BIOS assigned "
323 "this PCI card to IRQ %d, which is unlikely " 323 "this PCI card to IRQ %d, which is unlikely "
324 "to work!.\n" 324 "to work!.\n"
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index fd56128525d1..3bc54b30c3a1 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -298,7 +298,8 @@ struct pci_port_ops dino_port_ops = {
298 298
299static void dino_disable_irq(unsigned int irq) 299static void dino_disable_irq(unsigned int irq)
300{ 300{
301 struct dino_device *dino_dev = irq_desc[irq].chip_data; 301 struct irq_desc *desc = irq_to_desc(irq);
302 struct dino_device *dino_dev = desc->chip_data;
302 int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); 303 int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS);
303 304
304 DBG(KERN_WARNING "%s(0x%p, %d)\n", __func__, dino_dev, irq); 305 DBG(KERN_WARNING "%s(0x%p, %d)\n", __func__, dino_dev, irq);
@@ -310,7 +311,8 @@ static void dino_disable_irq(unsigned int irq)
310 311
311static void dino_enable_irq(unsigned int irq) 312static void dino_enable_irq(unsigned int irq)
312{ 313{
313 struct dino_device *dino_dev = irq_desc[irq].chip_data; 314 struct irq_desc *desc = irq_to_desc(irq);
315 struct dino_device *dino_dev = desc->chip_data;
314 int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); 316 int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS);
315 u32 tmp; 317 u32 tmp;
316 318
diff --git a/drivers/parisc/eisa.c b/drivers/parisc/eisa.c
index 771cef592542..7891db50c483 100644
--- a/drivers/parisc/eisa.c
+++ b/drivers/parisc/eisa.c
@@ -346,10 +346,10 @@ static int __init eisa_probe(struct parisc_device *dev)
346 } 346 }
347 347
348 /* Reserve IRQ2 */ 348 /* Reserve IRQ2 */
349 irq_desc[2].action = &irq2_action; 349 irq_to_desc(2)->action = &irq2_action;
350 350
351 for (i = 0; i < 16; i++) { 351 for (i = 0; i < 16; i++) {
352 irq_desc[i].chip = &eisa_interrupt_type; 352 irq_to_desc(i)->chip = &eisa_interrupt_type;
353 } 353 }
354 354
355 EISA_bus = 1; 355 EISA_bus = 1;
diff --git a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c
index f7d088b897ee..e76db9e4d504 100644
--- a/drivers/parisc/gsc.c
+++ b/drivers/parisc/gsc.c
@@ -108,7 +108,8 @@ int gsc_find_local_irq(unsigned int irq, int *global_irqs, int limit)
108 108
109static void gsc_asic_disable_irq(unsigned int irq) 109static void gsc_asic_disable_irq(unsigned int irq)
110{ 110{
111 struct gsc_asic *irq_dev = irq_desc[irq].chip_data; 111 struct irq_desc *desc = irq_to_desc(irq);
112 struct gsc_asic *irq_dev = desc->chip_data;
112 int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); 113 int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32);
113 u32 imr; 114 u32 imr;
114 115
@@ -123,7 +124,8 @@ static void gsc_asic_disable_irq(unsigned int irq)
123 124
124static void gsc_asic_enable_irq(unsigned int irq) 125static void gsc_asic_enable_irq(unsigned int irq)
125{ 126{
126 struct gsc_asic *irq_dev = irq_desc[irq].chip_data; 127 struct irq_desc *desc = irq_to_desc(irq);
128 struct gsc_asic *irq_dev = desc->chip_data;
127 int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); 129 int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32);
128 u32 imr; 130 u32 imr;
129 131
@@ -159,12 +161,14 @@ static struct hw_interrupt_type gsc_asic_interrupt_type = {
159int gsc_assign_irq(struct hw_interrupt_type *type, void *data) 161int gsc_assign_irq(struct hw_interrupt_type *type, void *data)
160{ 162{
161 static int irq = GSC_IRQ_BASE; 163 static int irq = GSC_IRQ_BASE;
164 struct irq_desc *desc;
162 165
163 if (irq > GSC_IRQ_MAX) 166 if (irq > GSC_IRQ_MAX)
164 return NO_IRQ; 167 return NO_IRQ;
165 168
166 irq_desc[irq].chip = type; 169 desc = irq_to_desc(irq);
167 irq_desc[irq].chip_data = data; 170 desc->chip = type;
171 desc->chip_data = data;
168 return irq++; 172 return irq++;
169} 173}
170 174
diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c
index 6fb3f7979f21..7beffcab2745 100644
--- a/drivers/parisc/iosapic.c
+++ b/drivers/parisc/iosapic.c
@@ -619,7 +619,9 @@ iosapic_set_irt_data( struct vector_info *vi, u32 *dp0, u32 *dp1)
619 619
620static struct vector_info *iosapic_get_vector(unsigned int irq) 620static struct vector_info *iosapic_get_vector(unsigned int irq)
621{ 621{
622 return irq_desc[irq].chip_data; 622 struct irq_desc *desc = irq_to_desc(irq);
623
624 return desc->chip_data;
623} 625}
624 626
625static void iosapic_disable_irq(unsigned int irq) 627static void iosapic_disable_irq(unsigned int irq)
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c
index 1e8d2d17f04c..1e93c837514f 100644
--- a/drivers/parisc/superio.c
+++ b/drivers/parisc/superio.c
@@ -363,7 +363,9 @@ int superio_fixup_irq(struct pci_dev *pcidev)
363#endif 363#endif
364 364
365 for (i = 0; i < 16; i++) { 365 for (i = 0; i < 16; i++) {
366 irq_desc[i].chip = &superio_interrupt_type; 366 struct irq_desc *desc = irq_to_desc(i);
367
368 desc->chip = &superio_interrupt_type;
367 } 369 }
368 370
369 /* 371 /*
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
index e842e756308a..8b29c307f1a1 100644
--- a/drivers/pci/dmar.c
+++ b/drivers/pci/dmar.c
@@ -193,7 +193,7 @@ dmar_parse_dev(struct dmar_drhd_unit *dmaru)
193{ 193{
194 struct acpi_dmar_hardware_unit *drhd; 194 struct acpi_dmar_hardware_unit *drhd;
195 static int include_all; 195 static int include_all;
196 int ret; 196 int ret = 0;
197 197
198 drhd = (struct acpi_dmar_hardware_unit *) dmaru->hdr; 198 drhd = (struct acpi_dmar_hardware_unit *) dmaru->hdr;
199 199
@@ -212,7 +212,7 @@ dmar_parse_dev(struct dmar_drhd_unit *dmaru)
212 include_all = 1; 212 include_all = 1;
213 } 213 }
214 214
215 if (ret || (dmaru->devices_cnt == 0 && !dmaru->include_all)) { 215 if (ret) {
216 list_del(&dmaru->list); 216 list_del(&dmaru->list);
217 kfree(dmaru); 217 kfree(dmaru);
218 } 218 }
@@ -289,6 +289,24 @@ dmar_table_print_dmar_entry(struct acpi_dmar_header *header)
289 } 289 }
290} 290}
291 291
292/**
293 * dmar_table_detect - checks to see if the platform supports DMAR devices
294 */
295static int __init dmar_table_detect(void)
296{
297 acpi_status status = AE_OK;
298
299 /* if we could find DMAR table, then there are DMAR devices */
300 status = acpi_get_table(ACPI_SIG_DMAR, 0,
301 (struct acpi_table_header **)&dmar_tbl);
302
303 if (ACPI_SUCCESS(status) && !dmar_tbl) {
304 printk (KERN_WARNING PREFIX "Unable to map DMAR\n");
305 status = AE_NOT_FOUND;
306 }
307
308 return (ACPI_SUCCESS(status) ? 1 : 0);
309}
292 310
293/** 311/**
294 * parse_dmar_table - parses the DMA reporting table 312 * parse_dmar_table - parses the DMA reporting table
@@ -300,6 +318,12 @@ parse_dmar_table(void)
300 struct acpi_dmar_header *entry_header; 318 struct acpi_dmar_header *entry_header;
301 int ret = 0; 319 int ret = 0;
302 320
321 /*
322 * Do it again, earlier dmar_tbl mapping could be mapped with
323 * fixed map.
324 */
325 dmar_table_detect();
326
303 dmar = (struct acpi_table_dmar *)dmar_tbl; 327 dmar = (struct acpi_table_dmar *)dmar_tbl;
304 if (!dmar) 328 if (!dmar)
305 return -ENODEV; 329 return -ENODEV;
@@ -373,10 +397,10 @@ dmar_find_matched_drhd_unit(struct pci_dev *dev)
373 397
374int __init dmar_dev_scope_init(void) 398int __init dmar_dev_scope_init(void)
375{ 399{
376 struct dmar_drhd_unit *drhd; 400 struct dmar_drhd_unit *drhd, *drhd_n;
377 int ret = -ENODEV; 401 int ret = -ENODEV;
378 402
379 for_each_drhd_unit(drhd) { 403 list_for_each_entry_safe(drhd, drhd_n, &dmar_drhd_units, list) {
380 ret = dmar_parse_dev(drhd); 404 ret = dmar_parse_dev(drhd);
381 if (ret) 405 if (ret)
382 return ret; 406 return ret;
@@ -384,8 +408,8 @@ int __init dmar_dev_scope_init(void)
384 408
385#ifdef CONFIG_DMAR 409#ifdef CONFIG_DMAR
386 { 410 {
387 struct dmar_rmrr_unit *rmrr; 411 struct dmar_rmrr_unit *rmrr, *rmrr_n;
388 for_each_rmrr_units(rmrr) { 412 list_for_each_entry_safe(rmrr, rmrr_n, &dmar_rmrr_units, list) {
389 ret = rmrr_parse_dev(rmrr); 413 ret = rmrr_parse_dev(rmrr);
390 if (ret) 414 if (ret)
391 return ret; 415 return ret;
@@ -430,30 +454,11 @@ int __init dmar_table_init(void)
430 return 0; 454 return 0;
431} 455}
432 456
433/**
434 * early_dmar_detect - checks to see if the platform supports DMAR devices
435 */
436int __init early_dmar_detect(void)
437{
438 acpi_status status = AE_OK;
439
440 /* if we could find DMAR table, then there are DMAR devices */
441 status = acpi_get_table(ACPI_SIG_DMAR, 0,
442 (struct acpi_table_header **)&dmar_tbl);
443
444 if (ACPI_SUCCESS(status) && !dmar_tbl) {
445 printk (KERN_WARNING PREFIX "Unable to map DMAR\n");
446 status = AE_NOT_FOUND;
447 }
448
449 return (ACPI_SUCCESS(status) ? 1 : 0);
450}
451
452void __init detect_intel_iommu(void) 457void __init detect_intel_iommu(void)
453{ 458{
454 int ret; 459 int ret;
455 460
456 ret = early_dmar_detect(); 461 ret = dmar_table_detect();
457 462
458#ifdef CONFIG_DMAR 463#ifdef CONFIG_DMAR
459 { 464 {
@@ -479,14 +484,16 @@ void __init detect_intel_iommu(void)
479 " x2apic support\n"); 484 " x2apic support\n");
480 485
481 dmar_disabled = 1; 486 dmar_disabled = 1;
482 return; 487 goto end;
483 } 488 }
484 489
485 if (ret && !no_iommu && !iommu_detected && !swiotlb && 490 if (ret && !no_iommu && !iommu_detected && !swiotlb &&
486 !dmar_disabled) 491 !dmar_disabled)
487 iommu_detected = 1; 492 iommu_detected = 1;
488 } 493 }
494end:
489#endif 495#endif
496 dmar_tbl = NULL;
490} 497}
491 498
492 499
diff --git a/drivers/pci/htirq.c b/drivers/pci/htirq.c
index 279c940a0039..bf7d6ce9bbb3 100644
--- a/drivers/pci/htirq.c
+++ b/drivers/pci/htirq.c
@@ -126,7 +126,8 @@ int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update)
126 cfg->msg.address_hi = 0xffffffff; 126 cfg->msg.address_hi = 0xffffffff;
127 127
128 irq = create_irq(); 128 irq = create_irq();
129 if (irq < 0) { 129
130 if (irq <= 0) {
130 kfree(cfg); 131 kfree(cfg);
131 return -EBUSY; 132 return -EBUSY;
132 } 133 }
diff --git a/drivers/pci/intr_remapping.c b/drivers/pci/intr_remapping.c
index 738d4c89581c..2de5a3238c94 100644
--- a/drivers/pci/intr_remapping.c
+++ b/drivers/pci/intr_remapping.c
@@ -1,3 +1,4 @@
1#include <linux/interrupt.h>
1#include <linux/dmar.h> 2#include <linux/dmar.h>
2#include <linux/spinlock.h> 3#include <linux/spinlock.h>
3#include <linux/jiffies.h> 4#include <linux/jiffies.h>
@@ -11,41 +12,64 @@ static struct ioapic_scope ir_ioapic[MAX_IO_APICS];
11static int ir_ioapic_num; 12static int ir_ioapic_num;
12int intr_remapping_enabled; 13int intr_remapping_enabled;
13 14
14static struct { 15struct irq_2_iommu {
15 struct intel_iommu *iommu; 16 struct intel_iommu *iommu;
16 u16 irte_index; 17 u16 irte_index;
17 u16 sub_handle; 18 u16 sub_handle;
18 u8 irte_mask; 19 u8 irte_mask;
19} irq_2_iommu[NR_IRQS]; 20};
21
22static struct irq_2_iommu irq_2_iommuX[NR_IRQS];
23
24static struct irq_2_iommu *irq_2_iommu(unsigned int irq)
25{
26 return (irq < nr_irqs) ? irq_2_iommuX + irq : NULL;
27}
28
29static struct irq_2_iommu *irq_2_iommu_alloc(unsigned int irq)
30{
31 return irq_2_iommu(irq);
32}
20 33
21static DEFINE_SPINLOCK(irq_2_ir_lock); 34static DEFINE_SPINLOCK(irq_2_ir_lock);
22 35
23int irq_remapped(int irq) 36static struct irq_2_iommu *valid_irq_2_iommu(unsigned int irq)
24{ 37{
25 if (irq > NR_IRQS) 38 struct irq_2_iommu *irq_iommu;
26 return 0; 39
40 irq_iommu = irq_2_iommu(irq);
41
42 if (!irq_iommu)
43 return NULL;
44
45 if (!irq_iommu->iommu)
46 return NULL;
27 47
28 if (!irq_2_iommu[irq].iommu) 48 return irq_iommu;
29 return 0; 49}
30 50
31 return 1; 51int irq_remapped(int irq)
52{
53 return valid_irq_2_iommu(irq) != NULL;
32} 54}
33 55
34int get_irte(int irq, struct irte *entry) 56int get_irte(int irq, struct irte *entry)
35{ 57{
36 int index; 58 int index;
59 struct irq_2_iommu *irq_iommu;
37 60
38 if (!entry || irq > NR_IRQS) 61 if (!entry)
39 return -1; 62 return -1;
40 63
41 spin_lock(&irq_2_ir_lock); 64 spin_lock(&irq_2_ir_lock);
42 if (!irq_2_iommu[irq].iommu) { 65 irq_iommu = valid_irq_2_iommu(irq);
66 if (!irq_iommu) {
43 spin_unlock(&irq_2_ir_lock); 67 spin_unlock(&irq_2_ir_lock);
44 return -1; 68 return -1;
45 } 69 }
46 70
47 index = irq_2_iommu[irq].irte_index + irq_2_iommu[irq].sub_handle; 71 index = irq_iommu->irte_index + irq_iommu->sub_handle;
48 *entry = *(irq_2_iommu[irq].iommu->ir_table->base + index); 72 *entry = *(irq_iommu->iommu->ir_table->base + index);
49 73
50 spin_unlock(&irq_2_ir_lock); 74 spin_unlock(&irq_2_ir_lock);
51 return 0; 75 return 0;
@@ -54,6 +78,7 @@ int get_irte(int irq, struct irte *entry)
54int alloc_irte(struct intel_iommu *iommu, int irq, u16 count) 78int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)
55{ 79{
56 struct ir_table *table = iommu->ir_table; 80 struct ir_table *table = iommu->ir_table;
81 struct irq_2_iommu *irq_iommu;
57 u16 index, start_index; 82 u16 index, start_index;
58 unsigned int mask = 0; 83 unsigned int mask = 0;
59 int i; 84 int i;
@@ -61,6 +86,10 @@ int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)
61 if (!count) 86 if (!count)
62 return -1; 87 return -1;
63 88
89 /* protect irq_2_iommu_alloc later */
90 if (irq >= nr_irqs)
91 return -1;
92
64 /* 93 /*
65 * start the IRTE search from index 0. 94 * start the IRTE search from index 0.
66 */ 95 */
@@ -100,10 +129,11 @@ int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)
100 for (i = index; i < index + count; i++) 129 for (i = index; i < index + count; i++)
101 table->base[i].present = 1; 130 table->base[i].present = 1;
102 131
103 irq_2_iommu[irq].iommu = iommu; 132 irq_iommu = irq_2_iommu_alloc(irq);
104 irq_2_iommu[irq].irte_index = index; 133 irq_iommu->iommu = iommu;
105 irq_2_iommu[irq].sub_handle = 0; 134 irq_iommu->irte_index = index;
106 irq_2_iommu[irq].irte_mask = mask; 135 irq_iommu->sub_handle = 0;
136 irq_iommu->irte_mask = mask;
107 137
108 spin_unlock(&irq_2_ir_lock); 138 spin_unlock(&irq_2_ir_lock);
109 139
@@ -124,31 +154,33 @@ static void qi_flush_iec(struct intel_iommu *iommu, int index, int mask)
124int map_irq_to_irte_handle(int irq, u16 *sub_handle) 154int map_irq_to_irte_handle(int irq, u16 *sub_handle)
125{ 155{
126 int index; 156 int index;
157 struct irq_2_iommu *irq_iommu;
127 158
128 spin_lock(&irq_2_ir_lock); 159 spin_lock(&irq_2_ir_lock);
129 if (irq >= NR_IRQS || !irq_2_iommu[irq].iommu) { 160 irq_iommu = valid_irq_2_iommu(irq);
161 if (!irq_iommu) {
130 spin_unlock(&irq_2_ir_lock); 162 spin_unlock(&irq_2_ir_lock);
131 return -1; 163 return -1;
132 } 164 }
133 165
134 *sub_handle = irq_2_iommu[irq].sub_handle; 166 *sub_handle = irq_iommu->sub_handle;
135 index = irq_2_iommu[irq].irte_index; 167 index = irq_iommu->irte_index;
136 spin_unlock(&irq_2_ir_lock); 168 spin_unlock(&irq_2_ir_lock);
137 return index; 169 return index;
138} 170}
139 171
140int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index, u16 subhandle) 172int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index, u16 subhandle)
141{ 173{
174 struct irq_2_iommu *irq_iommu;
175
142 spin_lock(&irq_2_ir_lock); 176 spin_lock(&irq_2_ir_lock);
143 if (irq >= NR_IRQS || irq_2_iommu[irq].iommu) {
144 spin_unlock(&irq_2_ir_lock);
145 return -1;
146 }
147 177
148 irq_2_iommu[irq].iommu = iommu; 178 irq_iommu = irq_2_iommu_alloc(irq);
149 irq_2_iommu[irq].irte_index = index; 179
150 irq_2_iommu[irq].sub_handle = subhandle; 180 irq_iommu->iommu = iommu;
151 irq_2_iommu[irq].irte_mask = 0; 181 irq_iommu->irte_index = index;
182 irq_iommu->sub_handle = subhandle;
183 irq_iommu->irte_mask = 0;
152 184
153 spin_unlock(&irq_2_ir_lock); 185 spin_unlock(&irq_2_ir_lock);
154 186
@@ -157,16 +189,19 @@ int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index, u16 subhandle)
157 189
158int clear_irte_irq(int irq, struct intel_iommu *iommu, u16 index) 190int clear_irte_irq(int irq, struct intel_iommu *iommu, u16 index)
159{ 191{
192 struct irq_2_iommu *irq_iommu;
193
160 spin_lock(&irq_2_ir_lock); 194 spin_lock(&irq_2_ir_lock);
161 if (irq >= NR_IRQS || !irq_2_iommu[irq].iommu) { 195 irq_iommu = valid_irq_2_iommu(irq);
196 if (!irq_iommu) {
162 spin_unlock(&irq_2_ir_lock); 197 spin_unlock(&irq_2_ir_lock);
163 return -1; 198 return -1;
164 } 199 }
165 200
166 irq_2_iommu[irq].iommu = NULL; 201 irq_iommu->iommu = NULL;
167 irq_2_iommu[irq].irte_index = 0; 202 irq_iommu->irte_index = 0;
168 irq_2_iommu[irq].sub_handle = 0; 203 irq_iommu->sub_handle = 0;
169 irq_2_iommu[irq].irte_mask = 0; 204 irq_2_iommu(irq)->irte_mask = 0;
170 205
171 spin_unlock(&irq_2_ir_lock); 206 spin_unlock(&irq_2_ir_lock);
172 207
@@ -178,16 +213,18 @@ int modify_irte(int irq, struct irte *irte_modified)
178 int index; 213 int index;
179 struct irte *irte; 214 struct irte *irte;
180 struct intel_iommu *iommu; 215 struct intel_iommu *iommu;
216 struct irq_2_iommu *irq_iommu;
181 217
182 spin_lock(&irq_2_ir_lock); 218 spin_lock(&irq_2_ir_lock);
183 if (irq >= NR_IRQS || !irq_2_iommu[irq].iommu) { 219 irq_iommu = valid_irq_2_iommu(irq);
220 if (!irq_iommu) {
184 spin_unlock(&irq_2_ir_lock); 221 spin_unlock(&irq_2_ir_lock);
185 return -1; 222 return -1;
186 } 223 }
187 224
188 iommu = irq_2_iommu[irq].iommu; 225 iommu = irq_iommu->iommu;
189 226
190 index = irq_2_iommu[irq].irte_index + irq_2_iommu[irq].sub_handle; 227 index = irq_iommu->irte_index + irq_iommu->sub_handle;
191 irte = &iommu->ir_table->base[index]; 228 irte = &iommu->ir_table->base[index];
192 229
193 set_64bit((unsigned long *)irte, irte_modified->low | (1 << 1)); 230 set_64bit((unsigned long *)irte, irte_modified->low | (1 << 1));
@@ -203,18 +240,20 @@ int flush_irte(int irq)
203{ 240{
204 int index; 241 int index;
205 struct intel_iommu *iommu; 242 struct intel_iommu *iommu;
243 struct irq_2_iommu *irq_iommu;
206 244
207 spin_lock(&irq_2_ir_lock); 245 spin_lock(&irq_2_ir_lock);
208 if (irq >= NR_IRQS || !irq_2_iommu[irq].iommu) { 246 irq_iommu = valid_irq_2_iommu(irq);
247 if (!irq_iommu) {
209 spin_unlock(&irq_2_ir_lock); 248 spin_unlock(&irq_2_ir_lock);
210 return -1; 249 return -1;
211 } 250 }
212 251
213 iommu = irq_2_iommu[irq].iommu; 252 iommu = irq_iommu->iommu;
214 253
215 index = irq_2_iommu[irq].irte_index + irq_2_iommu[irq].sub_handle; 254 index = irq_iommu->irte_index + irq_iommu->sub_handle;
216 255
217 qi_flush_iec(iommu, index, irq_2_iommu[irq].irte_mask); 256 qi_flush_iec(iommu, index, irq_iommu->irte_mask);
218 spin_unlock(&irq_2_ir_lock); 257 spin_unlock(&irq_2_ir_lock);
219 258
220 return 0; 259 return 0;
@@ -246,28 +285,30 @@ int free_irte(int irq)
246 int index, i; 285 int index, i;
247 struct irte *irte; 286 struct irte *irte;
248 struct intel_iommu *iommu; 287 struct intel_iommu *iommu;
288 struct irq_2_iommu *irq_iommu;
249 289
250 spin_lock(&irq_2_ir_lock); 290 spin_lock(&irq_2_ir_lock);
251 if (irq >= NR_IRQS || !irq_2_iommu[irq].iommu) { 291 irq_iommu = valid_irq_2_iommu(irq);
292 if (!irq_iommu) {
252 spin_unlock(&irq_2_ir_lock); 293 spin_unlock(&irq_2_ir_lock);
253 return -1; 294 return -1;
254 } 295 }
255 296
256 iommu = irq_2_iommu[irq].iommu; 297 iommu = irq_iommu->iommu;
257 298
258 index = irq_2_iommu[irq].irte_index + irq_2_iommu[irq].sub_handle; 299 index = irq_iommu->irte_index + irq_iommu->sub_handle;
259 irte = &iommu->ir_table->base[index]; 300 irte = &iommu->ir_table->base[index];
260 301
261 if (!irq_2_iommu[irq].sub_handle) { 302 if (!irq_iommu->sub_handle) {
262 for (i = 0; i < (1 << irq_2_iommu[irq].irte_mask); i++) 303 for (i = 0; i < (1 << irq_iommu->irte_mask); i++)
263 set_64bit((unsigned long *)irte, 0); 304 set_64bit((unsigned long *)irte, 0);
264 qi_flush_iec(iommu, index, irq_2_iommu[irq].irte_mask); 305 qi_flush_iec(iommu, index, irq_iommu->irte_mask);
265 } 306 }
266 307
267 irq_2_iommu[irq].iommu = NULL; 308 irq_iommu->iommu = NULL;
268 irq_2_iommu[irq].irte_index = 0; 309 irq_iommu->irte_index = 0;
269 irq_2_iommu[irq].sub_handle = 0; 310 irq_iommu->sub_handle = 0;
270 irq_2_iommu[irq].irte_mask = 0; 311 irq_iommu->irte_mask = 0;
271 312
272 spin_unlock(&irq_2_ir_lock); 313 spin_unlock(&irq_2_ir_lock);
273 314
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index a0ffb8ebfe00..9e1140f085fd 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -273,7 +273,7 @@ static int __init at91_cf_probe(struct platform_device *pdev)
273 goto fail0d; 273 goto fail0d;
274 cf->socket.pci_irq = board->irq_pin; 274 cf->socket.pci_irq = board->irq_pin;
275 } else 275 } else
276 cf->socket.pci_irq = NR_IRQS + 1; 276 cf->socket.pci_irq = nr_irqs + 1;
277 277
278 /* pcmcia layer only remaps "real" memory not iospace */ 278 /* pcmcia layer only remaps "real" memory not iospace */
279 cf->socket.io_offset = (unsigned long) 279 cf->socket.io_offset = (unsigned long)
diff --git a/drivers/pcmcia/hd64465_ss.c b/drivers/pcmcia/hd64465_ss.c
index 117dc12ab438..9ef69cdb3183 100644
--- a/drivers/pcmcia/hd64465_ss.c
+++ b/drivers/pcmcia/hd64465_ss.c
@@ -233,15 +233,18 @@ static struct hw_interrupt_type hd64465_ss_irq_type = {
233 */ 233 */
234static void hs_map_irq(hs_socket_t *sp, unsigned int irq) 234static void hs_map_irq(hs_socket_t *sp, unsigned int irq)
235{ 235{
236 struct irq_desc *desc;
237
236 DPRINTK("hs_map_irq(sock=%d irq=%d)\n", sp->number, irq); 238 DPRINTK("hs_map_irq(sock=%d irq=%d)\n", sp->number, irq);
237 239
238 if (irq >= HS_NUM_MAPPED_IRQS) 240 if (irq >= HS_NUM_MAPPED_IRQS)
239 return; 241 return;
240 242
243 desc = irq_to_desc(irq);
241 hs_mapped_irq[irq].sock = sp; 244 hs_mapped_irq[irq].sock = sp;
242 /* insert ourselves as the irq controller */ 245 /* insert ourselves as the irq controller */
243 hs_mapped_irq[irq].old_handler = irq_desc[irq].chip; 246 hs_mapped_irq[irq].old_handler = desc->chip;
244 irq_desc[irq].chip = &hd64465_ss_irq_type; 247 desc->chip = &hd64465_ss_irq_type;
245} 248}
246 249
247 250
@@ -250,13 +253,16 @@ static void hs_map_irq(hs_socket_t *sp, unsigned int irq)
250 */ 253 */
251static void hs_unmap_irq(hs_socket_t *sp, unsigned int irq) 254static void hs_unmap_irq(hs_socket_t *sp, unsigned int irq)
252{ 255{
256 struct irq_desc *desc;
257
253 DPRINTK("hs_unmap_irq(sock=%d irq=%d)\n", sp->number, irq); 258 DPRINTK("hs_unmap_irq(sock=%d irq=%d)\n", sp->number, irq);
254 259
255 if (irq >= HS_NUM_MAPPED_IRQS) 260 if (irq >= HS_NUM_MAPPED_IRQS)
256 return; 261 return;
257 262
263 desc = irq_to_desc(irq);
258 /* restore the original irq controller */ 264 /* restore the original irq controller */
259 irq_desc[irq].chip = hs_mapped_irq[irq].old_handler; 265 desc->chip = hs_mapped_irq[irq].old_handler;
260} 266}
261 267
262/*============================================================*/ 268/*============================================================*/
diff --git a/drivers/pcmcia/vrc4171_card.c b/drivers/pcmcia/vrc4171_card.c
index eee2f1cb213c..b2c412419059 100644
--- a/drivers/pcmcia/vrc4171_card.c
+++ b/drivers/pcmcia/vrc4171_card.c
@@ -639,7 +639,7 @@ static int __devinit vrc4171_card_setup(char *options)
639 int irq; 639 int irq;
640 options += 4; 640 options += 4;
641 irq = simple_strtoul(options, &options, 0); 641 irq = simple_strtoul(options, &options, 0);
642 if (irq >= 0 && irq < NR_IRQS) 642 if (irq >= 0 && irq < nr_irqs)
643 vrc4171_irq = irq; 643 vrc4171_irq = irq;
644 644
645 if (*options != ',') 645 if (*options != ',')
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c
index 884b635f028b..834dcc6d785f 100644
--- a/drivers/rtc/rtc-vr41xx.c
+++ b/drivers/rtc/rtc-vr41xx.c
@@ -360,7 +360,7 @@ static int __devinit rtc_probe(struct platform_device *pdev)
360 spin_unlock_irq(&rtc_lock); 360 spin_unlock_irq(&rtc_lock);
361 361
362 aie_irq = platform_get_irq(pdev, 0); 362 aie_irq = platform_get_irq(pdev, 0);
363 if (aie_irq < 0 || aie_irq >= NR_IRQS) { 363 if (aie_irq < 0 || aie_irq >= nr_irqs) {
364 retval = -EBUSY; 364 retval = -EBUSY;
365 goto err_device_unregister; 365 goto err_device_unregister;
366 } 366 }
@@ -371,7 +371,7 @@ static int __devinit rtc_probe(struct platform_device *pdev)
371 goto err_device_unregister; 371 goto err_device_unregister;
372 372
373 pie_irq = platform_get_irq(pdev, 1); 373 pie_irq = platform_get_irq(pdev, 1);
374 if (pie_irq < 0 || pie_irq >= NR_IRQS) 374 if (pie_irq < 0 || pie_irq >= nr_irqs)
375 goto err_free_irq; 375 goto err_free_irq;
376 376
377 retval = request_irq(pie_irq, rtclong1_interrupt, IRQF_DISABLED, 377 retval = request_irq(pie_irq, rtclong1_interrupt, IRQF_DISABLED,
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index b5a868d85eb4..1e5478abd90e 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -337,7 +337,7 @@ CMD_INC_RESID(struct scsi_cmnd *cmd, int inc)
337#else 337#else
338#define IRQ_MIN 9 338#define IRQ_MIN 9
339#if defined(__PPC) 339#if defined(__PPC)
340#define IRQ_MAX (NR_IRQS-1) 340#define IRQ_MAX (nr_irqs-1)
341#else 341#else
342#define IRQ_MAX 12 342#define IRQ_MAX 12
343#endif 343#endif
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 83c819216771..f25f41a499e5 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2108,7 +2108,7 @@ struct scsi_qla_host;
2108 2108
2109struct qla_msix_entry { 2109struct qla_msix_entry {
2110 int have_irq; 2110 int have_irq;
2111 uint16_t msix_vector; 2111 uint32_t msix_vector;
2112 uint16_t msix_entry; 2112 uint16_t msix_entry;
2113}; 2113};
2114 2114
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c
index 381b12ac20e0..d935b2d04f93 100644
--- a/drivers/serial/68328serial.c
+++ b/drivers/serial/68328serial.c
@@ -66,7 +66,6 @@
66#endif 66#endif
67 67
68static struct m68k_serial m68k_soft[NR_PORTS]; 68static struct m68k_serial m68k_soft[NR_PORTS];
69struct m68k_serial *IRQ_ports[NR_IRQS];
70 69
71static unsigned int uart_irqs[NR_PORTS] = UART_IRQ_DEFNS; 70static unsigned int uart_irqs[NR_PORTS] = UART_IRQ_DEFNS;
72 71
@@ -375,15 +374,11 @@ clear_and_return:
375 */ 374 */
376irqreturn_t rs_interrupt(int irq, void *dev_id) 375irqreturn_t rs_interrupt(int irq, void *dev_id)
377{ 376{
378 struct m68k_serial * info; 377 struct m68k_serial *info = dev_id;
379 m68328_uart *uart; 378 m68328_uart *uart;
380 unsigned short rx; 379 unsigned short rx;
381 unsigned short tx; 380 unsigned short tx;
382 381
383 info = IRQ_ports[irq];
384 if(!info)
385 return IRQ_NONE;
386
387 uart = &uart_addr[info->line]; 382 uart = &uart_addr[info->line];
388 rx = uart->urx.w; 383 rx = uart->urx.w;
389 384
@@ -1383,8 +1378,6 @@ rs68328_init(void)
1383 info->port, info->irq); 1378 info->port, info->irq);
1384 printk(" is a builtin MC68328 UART\n"); 1379 printk(" is a builtin MC68328 UART\n");
1385 1380
1386 IRQ_ports[info->irq] = info; /* waste of space */
1387
1388#ifdef CONFIG_M68VZ328 1381#ifdef CONFIG_M68VZ328
1389 if (i > 0 ) 1382 if (i > 0 )
1390 PJSEL &= 0xCF; /* PSW enable second port output */ 1383 PJSEL &= 0xCF; /* PSW enable second port output */
@@ -1393,7 +1386,7 @@ rs68328_init(void)
1393 if (request_irq(uart_irqs[i], 1386 if (request_irq(uart_irqs[i],
1394 rs_interrupt, 1387 rs_interrupt,
1395 IRQF_DISABLED, 1388 IRQF_DISABLED,
1396 "M68328_UART", NULL)) 1389 "M68328_UART", info))
1397 panic("Unable to attach 68328 serial interrupt\n"); 1390 panic("Unable to attach 68328 serial interrupt\n");
1398 } 1391 }
1399 local_irq_restore(flags); 1392 local_irq_restore(flags);
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 1528de23a650..303272af386e 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -156,11 +156,15 @@ struct uart_8250_port {
156}; 156};
157 157
158struct irq_info { 158struct irq_info {
159 spinlock_t lock; 159 struct hlist_node node;
160 int irq;
161 spinlock_t lock; /* Protects list not the hash */
160 struct list_head *head; 162 struct list_head *head;
161}; 163};
162 164
163static struct irq_info irq_lists[NR_IRQS]; 165#define NR_IRQ_HASH 32 /* Can be adjusted later */
166static struct hlist_head irq_lists[NR_IRQ_HASH];
167static DEFINE_MUTEX(hash_mutex); /* Used to walk the hash */
164 168
165/* 169/*
166 * Here we define the default xmit fifo size used for each type of UART. 170 * Here we define the default xmit fifo size used for each type of UART.
@@ -1545,15 +1549,43 @@ static void serial_do_unlink(struct irq_info *i, struct uart_8250_port *up)
1545 BUG_ON(i->head != &up->list); 1549 BUG_ON(i->head != &up->list);
1546 i->head = NULL; 1550 i->head = NULL;
1547 } 1551 }
1548
1549 spin_unlock_irq(&i->lock); 1552 spin_unlock_irq(&i->lock);
1553 /* List empty so throw away the hash node */
1554 if (i->head == NULL) {
1555 hlist_del(&i->node);
1556 kfree(i);
1557 }
1550} 1558}
1551 1559
1552static int serial_link_irq_chain(struct uart_8250_port *up) 1560static int serial_link_irq_chain(struct uart_8250_port *up)
1553{ 1561{
1554 struct irq_info *i = irq_lists + up->port.irq; 1562 struct hlist_head *h;
1563 struct hlist_node *n;
1564 struct irq_info *i;
1555 int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? IRQF_SHARED : 0; 1565 int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? IRQF_SHARED : 0;
1556 1566
1567 mutex_lock(&hash_mutex);
1568
1569 h = &irq_lists[up->port.irq % NR_IRQ_HASH];
1570
1571 hlist_for_each(n, h) {
1572 i = hlist_entry(n, struct irq_info, node);
1573 if (i->irq == up->port.irq)
1574 break;
1575 }
1576
1577 if (n == NULL) {
1578 i = kzalloc(sizeof(struct irq_info), GFP_KERNEL);
1579 if (i == NULL) {
1580 mutex_unlock(&hash_mutex);
1581 return -ENOMEM;
1582 }
1583 spin_lock_init(&i->lock);
1584 i->irq = up->port.irq;
1585 hlist_add_head(&i->node, h);
1586 }
1587 mutex_unlock(&hash_mutex);
1588
1557 spin_lock_irq(&i->lock); 1589 spin_lock_irq(&i->lock);
1558 1590
1559 if (i->head) { 1591 if (i->head) {
@@ -1577,14 +1609,28 @@ static int serial_link_irq_chain(struct uart_8250_port *up)
1577 1609
1578static void serial_unlink_irq_chain(struct uart_8250_port *up) 1610static void serial_unlink_irq_chain(struct uart_8250_port *up)
1579{ 1611{
1580 struct irq_info *i = irq_lists + up->port.irq; 1612 struct irq_info *i;
1613 struct hlist_node *n;
1614 struct hlist_head *h;
1581 1615
1616 mutex_lock(&hash_mutex);
1617
1618 h = &irq_lists[up->port.irq % NR_IRQ_HASH];
1619
1620 hlist_for_each(n, h) {
1621 i = hlist_entry(n, struct irq_info, node);
1622 if (i->irq == up->port.irq)
1623 break;
1624 }
1625
1626 BUG_ON(n == NULL);
1582 BUG_ON(i->head == NULL); 1627 BUG_ON(i->head == NULL);
1583 1628
1584 if (list_empty(i->head)) 1629 if (list_empty(i->head))
1585 free_irq(up->port.irq, i); 1630 free_irq(up->port.irq, i);
1586 1631
1587 serial_do_unlink(i, up); 1632 serial_do_unlink(i, up);
1633 mutex_unlock(&hash_mutex);
1588} 1634}
1589 1635
1590/* Base timer interval for polling */ 1636/* Base timer interval for polling */
@@ -2447,7 +2493,7 @@ static void serial8250_config_port(struct uart_port *port, int flags)
2447static int 2493static int
2448serial8250_verify_port(struct uart_port *port, struct serial_struct *ser) 2494serial8250_verify_port(struct uart_port *port, struct serial_struct *ser)
2449{ 2495{
2450 if (ser->irq >= NR_IRQS || ser->irq < 0 || 2496 if (ser->irq >= nr_irqs || ser->irq < 0 ||
2451 ser->baud_base < 9600 || ser->type < PORT_UNKNOWN || 2497 ser->baud_base < 9600 || ser->type < PORT_UNKNOWN ||
2452 ser->type >= ARRAY_SIZE(uart_config) || ser->type == PORT_CIRRUS || 2498 ser->type >= ARRAY_SIZE(uart_config) || ser->type == PORT_CIRRUS ||
2453 ser->type == PORT_STARTECH) 2499 ser->type == PORT_STARTECH)
@@ -2967,7 +3013,7 @@ EXPORT_SYMBOL(serial8250_unregister_port);
2967 3013
2968static int __init serial8250_init(void) 3014static int __init serial8250_init(void)
2969{ 3015{
2970 int ret, i; 3016 int ret;
2971 3017
2972 if (nr_uarts > UART_NR) 3018 if (nr_uarts > UART_NR)
2973 nr_uarts = UART_NR; 3019 nr_uarts = UART_NR;
@@ -2976,9 +3022,6 @@ static int __init serial8250_init(void)
2976 "%d ports, IRQ sharing %sabled\n", nr_uarts, 3022 "%d ports, IRQ sharing %sabled\n", nr_uarts,
2977 share_irqs ? "en" : "dis"); 3023 share_irqs ? "en" : "dis");
2978 3024
2979 for (i = 0; i < NR_IRQS; i++)
2980 spin_lock_init(&irq_lists[i].lock);
2981
2982#ifdef CONFIG_SPARC 3025#ifdef CONFIG_SPARC
2983 ret = sunserial_register_minors(&serial8250_reg, UART_NR); 3026 ret = sunserial_register_minors(&serial8250_reg, UART_NR);
2984#else 3027#else
@@ -3006,15 +3049,15 @@ static int __init serial8250_init(void)
3006 goto out; 3049 goto out;
3007 3050
3008 platform_device_del(serial8250_isa_devs); 3051 platform_device_del(serial8250_isa_devs);
3009 put_dev: 3052put_dev:
3010 platform_device_put(serial8250_isa_devs); 3053 platform_device_put(serial8250_isa_devs);
3011 unreg_uart_drv: 3054unreg_uart_drv:
3012#ifdef CONFIG_SPARC 3055#ifdef CONFIG_SPARC
3013 sunserial_unregister_minors(&serial8250_reg, UART_NR); 3056 sunserial_unregister_minors(&serial8250_reg, UART_NR);
3014#else 3057#else
3015 uart_unregister_driver(&serial8250_reg); 3058 uart_unregister_driver(&serial8250_reg);
3016#endif 3059#endif
3017 out: 3060out:
3018 return ret; 3061 return ret;
3019} 3062}
3020 3063
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index 90b56c2c31e2..71562689116f 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -512,7 +512,7 @@ static int pl010_verify_port(struct uart_port *port, struct serial_struct *ser)
512 int ret = 0; 512 int ret = 0;
513 if (ser->type != PORT_UNKNOWN && ser->type != PORT_AMBA) 513 if (ser->type != PORT_UNKNOWN && ser->type != PORT_AMBA)
514 ret = -EINVAL; 514 ret = -EINVAL;
515 if (ser->irq < 0 || ser->irq >= NR_IRQS) 515 if (ser->irq < 0 || ser->irq >= nr_irqs)
516 ret = -EINVAL; 516 ret = -EINVAL;
517 if (ser->baud_base < 9600) 517 if (ser->baud_base < 9600)
518 ret = -EINVAL; 518 ret = -EINVAL;
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 9d08f27208a1..b7180046f8db 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -572,7 +572,7 @@ static int pl010_verify_port(struct uart_port *port, struct serial_struct *ser)
572 int ret = 0; 572 int ret = 0;
573 if (ser->type != PORT_UNKNOWN && ser->type != PORT_AMBA) 573 if (ser->type != PORT_UNKNOWN && ser->type != PORT_AMBA)
574 ret = -EINVAL; 574 ret = -EINVAL;
575 if (ser->irq < 0 || ser->irq >= NR_IRQS) 575 if (ser->irq < 0 || ser->irq >= nr_irqs)
576 ret = -EINVAL; 576 ret = -EINVAL;
577 if (ser->baud_base < 9600) 577 if (ser->baud_base < 9600)
578 ret = -EINVAL; 578 ret = -EINVAL;
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index a6c4d744495e..bde4b4b0b80f 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -623,7 +623,7 @@ static int cpm_uart_verify_port(struct uart_port *port,
623 623
624 if (ser->type != PORT_UNKNOWN && ser->type != PORT_CPM) 624 if (ser->type != PORT_UNKNOWN && ser->type != PORT_CPM)
625 ret = -EINVAL; 625 ret = -EINVAL;
626 if (ser->irq < 0 || ser->irq >= NR_IRQS) 626 if (ser->irq < 0 || ser->irq >= nr_irqs)
627 ret = -EINVAL; 627 ret = -EINVAL;
628 if (ser->baud_base < 9600) 628 if (ser->baud_base < 9600)
629 ret = -EINVAL; 629 ret = -EINVAL;
diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c
index 23d030511019..611c97a15654 100644
--- a/drivers/serial/m32r_sio.c
+++ b/drivers/serial/m32r_sio.c
@@ -922,7 +922,7 @@ static void m32r_sio_config_port(struct uart_port *port, int flags)
922static int 922static int
923m32r_sio_verify_port(struct uart_port *port, struct serial_struct *ser) 923m32r_sio_verify_port(struct uart_port *port, struct serial_struct *ser)
924{ 924{
925 if (ser->irq >= NR_IRQS || ser->irq < 0 || 925 if (ser->irq >= nr_irqs || ser->irq < 0 ||
926 ser->baud_base < 9600 || ser->type < PORT_UNKNOWN || 926 ser->baud_base < 9600 || ser->type < PORT_UNKNOWN ||
927 ser->type >= ARRAY_SIZE(uart_config)) 927 ser->type >= ARRAY_SIZE(uart_config))
928 return -EINVAL; 928 return -EINVAL;
@@ -1162,7 +1162,7 @@ static int __init m32r_sio_init(void)
1162 1162
1163 printk(KERN_INFO "Serial: M32R SIO driver\n"); 1163 printk(KERN_INFO "Serial: M32R SIO driver\n");
1164 1164
1165 for (i = 0; i < NR_IRQS; i++) 1165 for (i = 0; i < nr_irqs; i++)
1166 spin_lock_init(&irq_lists[i].lock); 1166 spin_lock_init(&irq_lists[i].lock);
1167 1167
1168 ret = uart_register_driver(&m32r_sio_reg); 1168 ret = uart_register_driver(&m32r_sio_reg);
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 6bdf3362e3b1..874786a11fe9 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -741,7 +741,7 @@ static int uart_set_info(struct uart_state *state,
741 if (port->ops->verify_port) 741 if (port->ops->verify_port)
742 retval = port->ops->verify_port(port, &new_serial); 742 retval = port->ops->verify_port(port, &new_serial);
743 743
744 if ((new_serial.irq >= NR_IRQS) || (new_serial.irq < 0) || 744 if ((new_serial.irq >= nr_irqs) || (new_serial.irq < 0) ||
745 (new_serial.baud_base < 9600)) 745 (new_serial.baud_base < 9600))
746 retval = -EINVAL; 746 retval = -EINVAL;
747 747
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c
index cb49a5ac022f..61dc8b3daa26 100644
--- a/drivers/serial/serial_lh7a40x.c
+++ b/drivers/serial/serial_lh7a40x.c
@@ -460,7 +460,7 @@ static int lh7a40xuart_verify_port (struct uart_port* port,
460 460
461 if (ser->type != PORT_UNKNOWN && ser->type != PORT_LH7A40X) 461 if (ser->type != PORT_UNKNOWN && ser->type != PORT_LH7A40X)
462 ret = -EINVAL; 462 ret = -EINVAL;
463 if (ser->irq < 0 || ser->irq >= NR_IRQS) 463 if (ser->irq < 0 || ser->irq >= nr_irqs)
464 ret = -EINVAL; 464 ret = -EINVAL;
465 if (ser->baud_base < 9600) /* *** FIXME: is this true? */ 465 if (ser->baud_base < 9600) /* *** FIXME: is this true? */
466 ret = -EINVAL; 466 ret = -EINVAL;
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 3b9d2d83b590..f0658d2c45b2 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -1149,7 +1149,7 @@ static int sci_verify_port(struct uart_port *port, struct serial_struct *ser)
1149{ 1149{
1150 struct sci_port *s = &sci_ports[port->line]; 1150 struct sci_port *s = &sci_ports[port->line];
1151 1151
1152 if (ser->irq != s->irqs[SCIx_TXI_IRQ] || ser->irq > NR_IRQS) 1152 if (ser->irq != s->irqs[SCIx_TXI_IRQ] || ser->irq > nr_irqs)
1153 return -EINVAL; 1153 return -EINVAL;
1154 if (ser->baud_base < 2400) 1154 if (ser->baud_base < 2400)
1155 /* No paper tape reader for Mitch.. */ 1155 /* No paper tape reader for Mitch.. */
diff --git a/drivers/serial/ucc_uart.c b/drivers/serial/ucc_uart.c
index 539c933b335f..315a9333ca3c 100644
--- a/drivers/serial/ucc_uart.c
+++ b/drivers/serial/ucc_uart.c
@@ -1066,7 +1066,7 @@ static int qe_uart_verify_port(struct uart_port *port,
1066 if (ser->type != PORT_UNKNOWN && ser->type != PORT_CPM) 1066 if (ser->type != PORT_UNKNOWN && ser->type != PORT_CPM)
1067 return -EINVAL; 1067 return -EINVAL;
1068 1068
1069 if (ser->irq < 0 || ser->irq >= NR_IRQS) 1069 if (ser->irq < 0 || ser->irq >= nr_irqs)
1070 return -EINVAL; 1070 return -EINVAL;
1071 1071
1072 if (ser->baud_base < 9600) 1072 if (ser->baud_base < 9600)
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index c3290bc186a0..9ce1ab6c268d 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -125,7 +125,7 @@ static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
125 125
126 BUG_ON(irq == -1); 126 BUG_ON(irq == -1);
127#ifdef CONFIG_SMP 127#ifdef CONFIG_SMP
128 irq_desc[irq].affinity = cpumask_of_cpu(cpu); 128 irq_to_desc(irq)->affinity = cpumask_of_cpu(cpu);
129#endif 129#endif
130 130
131 __clear_bit(chn, cpu_evtchn_mask[cpu_evtchn[chn]]); 131 __clear_bit(chn, cpu_evtchn_mask[cpu_evtchn[chn]]);
@@ -137,10 +137,12 @@ static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
137static void init_evtchn_cpu_bindings(void) 137static void init_evtchn_cpu_bindings(void)
138{ 138{
139#ifdef CONFIG_SMP 139#ifdef CONFIG_SMP
140 struct irq_desc *desc;
140 int i; 141 int i;
142
141 /* By default all event channels notify CPU#0. */ 143 /* By default all event channels notify CPU#0. */
142 for (i = 0; i < NR_IRQS; i++) 144 for_each_irq_desc(i, desc)
143 irq_desc[i].affinity = cpumask_of_cpu(0); 145 desc->affinity = cpumask_of_cpu(0);
144#endif 146#endif
145 147
146 memset(cpu_evtchn, 0, sizeof(cpu_evtchn)); 148 memset(cpu_evtchn, 0, sizeof(cpu_evtchn));
@@ -229,12 +231,12 @@ static int find_unbound_irq(void)
229 int irq; 231 int irq;
230 232
231 /* Only allocate from dynirq range */ 233 /* Only allocate from dynirq range */
232 for (irq = 0; irq < NR_IRQS; irq++) 234 for_each_irq_nr(irq)
233 if (irq_bindcount[irq] == 0) 235 if (irq_bindcount[irq] == 0)
234 break; 236 break;
235 237
236 if (irq == NR_IRQS) 238 if (irq == nr_irqs)
237 panic("No available IRQ to bind to: increase NR_IRQS!\n"); 239 panic("No available IRQ to bind to: increase nr_irqs!\n");
238 240
239 return irq; 241 return irq;
240} 242}
@@ -790,7 +792,7 @@ void xen_irq_resume(void)
790 mask_evtchn(evtchn); 792 mask_evtchn(evtchn);
791 793
792 /* No IRQ <-> event-channel mappings. */ 794 /* No IRQ <-> event-channel mappings. */
793 for (irq = 0; irq < NR_IRQS; irq++) 795 for_each_irq_nr(irq)
794 irq_info[irq].evtchn = 0; /* zap event-channel binding */ 796 irq_info[irq].evtchn = 0; /* zap event-channel binding */
795 797
796 for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) 798 for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++)
@@ -822,7 +824,7 @@ void __init xen_init_IRQ(void)
822 mask_evtchn(i); 824 mask_evtchn(i);
823 825
824 /* Dynamic IRQ space is currently unbound. Zero the refcnts. */ 826 /* Dynamic IRQ space is currently unbound. Zero the refcnts. */
825 for (i = 0; i < NR_IRQS; i++) 827 for_each_irq_nr(i)
826 irq_bindcount[i] = 0; 828 irq_bindcount[i] = 0;
827 829
828 irq_ctx_init(smp_processor_id()); 830 irq_ctx_init(smp_processor_id());