aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-08-19 23:49:47 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-16 10:52:05 -0400
commit85c0f90978bf50596dbd23854648020f1f9b5bfd (patch)
treef66c598bb37b925dd6c74e4ce1fb06345c742c01
parent6da55c3e8da88e8a7cb6452160776ad6706798ad (diff)
irq: introduce nr_irqs
at this point nr_irqs is equal NR_IRQS convert a few easy users from NR_IRQS to dynamic nr_irqs. v2: according to Eric, we need to take care of arch without generic_hardirqs Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/m68k/kernel/ints.c2
-rw-r--r--arch/s390/kernel/irq.c2
-rw-r--r--arch/sparc/kernel/irq.c3
-rw-r--r--include/linux/interrupt.h2
-rw-r--r--kernel/irq/autoprobe.c10
-rw-r--r--kernel/irq/chip.c20
-rw-r--r--kernel/irq/handle.c3
-rw-r--r--kernel/irq/manage.c16
-rw-r--r--kernel/irq/proc.c2
-rw-r--r--kernel/irq/resend.c4
-rw-r--r--kernel/irq/spurious.c4
11 files changed, 39 insertions, 29 deletions
diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c
index 7e8a0d394e61..74453d15692e 100644
--- a/arch/m68k/kernel/ints.c
+++ b/arch/m68k/kernel/ints.c
@@ -46,6 +46,8 @@
46#include <asm/q40ints.h> 46#include <asm/q40ints.h>
47#endif 47#endif
48 48
49int nr_irqs = NR_IRQS;
50
49extern u32 auto_irqhandler_fixup[]; 51extern u32 auto_irqhandler_fixup[];
50extern u32 user_irqhandler_fixup[]; 52extern u32 user_irqhandler_fixup[];
51extern u16 user_irqvec_fixup[]; 53extern u16 user_irqvec_fixup[];
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index e7c5bfb7c755..14eb5496c8a8 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -17,6 +17,8 @@
17#include <linux/proc_fs.h> 17#include <linux/proc_fs.h>
18#include <linux/profile.h> 18#include <linux/profile.h>
19 19
20int nr_irqs = NR_IRQS;
21
20/* 22/*
21 * show_interrupts is needed by /proc/interrupts. 23 * show_interrupts is needed by /proc/interrupts.
22 */ 24 */
diff --git a/arch/sparc/kernel/irq.c b/arch/sparc/kernel/irq.c
index 93e1d1c65290..059598b7e0f0 100644
--- a/arch/sparc/kernel/irq.c
+++ b/arch/sparc/kernel/irq.c
@@ -55,6 +55,9 @@
55#define SMP_NOP2 55#define SMP_NOP2
56#define SMP_NOP3 56#define SMP_NOP3
57#endif /* SMP */ 57#endif /* SMP */
58
59int nr_irqs = NR_IRQS;
60
58unsigned long __raw_local_irq_save(void) 61unsigned long __raw_local_irq_save(void)
59{ 62{
60 unsigned long retval; 63 unsigned long retval;
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 58ff4e74b2f3..511803853a5b 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -15,6 +15,8 @@
15#include <asm/ptrace.h> 15#include <asm/ptrace.h>
16#include <asm/system.h> 16#include <asm/system.h>
17 17
18extern int nr_irqs;
19
18/* 20/*
19 * These correspond to the IORESOURCE_IRQ_* defines in 21 * These correspond to the IORESOURCE_IRQ_* defines in
20 * linux/ioport.h to select the interrupt line behaviour. When 22 * linux/ioport.h to select the interrupt line behaviour. When
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c
index 533068cfb607..c689e9851a80 100644
--- a/kernel/irq/autoprobe.c
+++ b/kernel/irq/autoprobe.c
@@ -38,7 +38,7 @@ unsigned long probe_irq_on(void)
38 * something may have generated an irq long ago and we want to 38 * something may have generated an irq long ago and we want to
39 * flush such a longstanding irq before considering it as spurious. 39 * flush such a longstanding irq before considering it as spurious.
40 */ 40 */
41 for (i = NR_IRQS-1; i > 0; i--) { 41 for (i = nr_irqs-1; i > 0; i--) {
42 desc = irq_desc + i; 42 desc = irq_desc + i;
43 43
44 spin_lock_irq(&desc->lock); 44 spin_lock_irq(&desc->lock);
@@ -68,7 +68,7 @@ unsigned long probe_irq_on(void)
68 * (we must startup again here because if a longstanding irq 68 * (we must startup again here because if a longstanding irq
69 * happened in the previous stage, it may have masked itself) 69 * happened in the previous stage, it may have masked itself)
70 */ 70 */
71 for (i = NR_IRQS-1; i > 0; i--) { 71 for (i = nr_irqs-1; i > 0; i--) {
72 desc = irq_desc + i; 72 desc = irq_desc + i;
73 73
74 spin_lock_irq(&desc->lock); 74 spin_lock_irq(&desc->lock);
@@ -89,7 +89,7 @@ unsigned long probe_irq_on(void)
89 * Now filter out any obviously spurious interrupts 89 * Now filter out any obviously spurious interrupts
90 */ 90 */
91 mask = 0; 91 mask = 0;
92 for (i = 0; i < NR_IRQS; i++) { 92 for (i = 0; i < nr_irqs; i++) {
93 unsigned int status; 93 unsigned int status;
94 94
95 desc = irq_desc + i; 95 desc = irq_desc + i;
@@ -130,7 +130,7 @@ unsigned int probe_irq_mask(unsigned long val)
130 int i; 130 int i;
131 131
132 mask = 0; 132 mask = 0;
133 for (i = 0; i < NR_IRQS; i++) { 133 for (i = 0; i < nr_irqs; i++) {
134 struct irq_desc *desc = irq_desc + i; 134 struct irq_desc *desc = irq_desc + i;
135 unsigned int status; 135 unsigned int status;
136 136
@@ -173,7 +173,7 @@ int probe_irq_off(unsigned long val)
173{ 173{
174 int i, irq_found = 0, nr_irqs = 0; 174 int i, irq_found = 0, nr_irqs = 0;
175 175
176 for (i = 0; i < NR_IRQS; i++) { 176 for (i = 0; i < nr_irqs; i++) {
177 struct irq_desc *desc = irq_desc + i; 177 struct irq_desc *desc = irq_desc + i;
178 unsigned int status; 178 unsigned int status;
179 179
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 5203a599d211..bba66e098703 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -27,7 +27,7 @@ void dynamic_irq_init(unsigned int irq)
27 struct irq_desc *desc; 27 struct irq_desc *desc;
28 unsigned long flags; 28 unsigned long flags;
29 29
30 if (irq >= NR_IRQS) { 30 if (irq >= nr_irqs) {
31 WARN(1, KERN_ERR "Trying to initialize invalid IRQ%d\n", irq); 31 WARN(1, KERN_ERR "Trying to initialize invalid IRQ%d\n", irq);
32 return; 32 return;
33 } 33 }
@@ -60,7 +60,7 @@ void dynamic_irq_cleanup(unsigned int irq)
60 struct irq_desc *desc; 60 struct irq_desc *desc;
61 unsigned long flags; 61 unsigned long flags;
62 62
63 if (irq >= NR_IRQS) { 63 if (irq >= nr_irqs) {
64 WARN(1, KERN_ERR "Trying to cleanup invalid IRQ%d\n", irq); 64 WARN(1, KERN_ERR "Trying to cleanup invalid IRQ%d\n", irq);
65 return; 65 return;
66 } 66 }
@@ -92,7 +92,7 @@ int set_irq_chip(unsigned int irq, struct irq_chip *chip)
92 struct irq_desc *desc; 92 struct irq_desc *desc;
93 unsigned long flags; 93 unsigned long flags;
94 94
95 if (irq >= NR_IRQS) { 95 if (irq >= nr_irqs) {
96 WARN(1, KERN_ERR "Trying to install chip for IRQ%d\n", irq); 96 WARN(1, KERN_ERR "Trying to install chip for IRQ%d\n", irq);
97 return -EINVAL; 97 return -EINVAL;
98 } 98 }
@@ -121,7 +121,7 @@ int set_irq_type(unsigned int irq, unsigned int type)
121 unsigned long flags; 121 unsigned long flags;
122 int ret = -ENXIO; 122 int ret = -ENXIO;
123 123
124 if (irq >= NR_IRQS) { 124 if (irq >= nr_irqs) {
125 printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq); 125 printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq);
126 return -ENODEV; 126 return -ENODEV;
127 } 127 }
@@ -149,7 +149,7 @@ int set_irq_data(unsigned int irq, void *data)
149 struct irq_desc *desc; 149 struct irq_desc *desc;
150 unsigned long flags; 150 unsigned long flags;
151 151
152 if (irq >= NR_IRQS) { 152 if (irq >= nr_irqs) {
153 printk(KERN_ERR 153 printk(KERN_ERR
154 "Trying to install controller data for IRQ%d\n", irq); 154 "Trying to install controller data for IRQ%d\n", irq);
155 return -EINVAL; 155 return -EINVAL;
@@ -175,7 +175,7 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry)
175 struct irq_desc *desc; 175 struct irq_desc *desc;
176 unsigned long flags; 176 unsigned long flags;
177 177
178 if (irq >= NR_IRQS) { 178 if (irq >= nr_irqs) {
179 printk(KERN_ERR 179 printk(KERN_ERR
180 "Trying to install msi data for IRQ%d\n", irq); 180 "Trying to install msi data for IRQ%d\n", irq);
181 return -EINVAL; 181 return -EINVAL;
@@ -201,7 +201,7 @@ int set_irq_chip_data(unsigned int irq, void *data)
201 struct irq_desc *desc = irq_desc + irq; 201 struct irq_desc *desc = irq_desc + irq;
202 unsigned long flags; 202 unsigned long flags;
203 203
204 if (irq >= NR_IRQS || !desc->chip) { 204 if (irq >= nr_irqs || !desc->chip) {
205 printk(KERN_ERR "BUG: bad set_irq_chip_data(IRQ#%d)\n", irq); 205 printk(KERN_ERR "BUG: bad set_irq_chip_data(IRQ#%d)\n", irq);
206 return -EINVAL; 206 return -EINVAL;
207 } 207 }
@@ -545,7 +545,7 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
545 struct irq_desc *desc; 545 struct irq_desc *desc;
546 unsigned long flags; 546 unsigned long flags;
547 547
548 if (irq >= NR_IRQS) { 548 if (irq >= nr_irqs) {
549 printk(KERN_ERR 549 printk(KERN_ERR
550 "Trying to install type control for IRQ%d\n", irq); 550 "Trying to install type control for IRQ%d\n", irq);
551 return; 551 return;
@@ -610,7 +610,7 @@ void __init set_irq_noprobe(unsigned int irq)
610 struct irq_desc *desc; 610 struct irq_desc *desc;
611 unsigned long flags; 611 unsigned long flags;
612 612
613 if (irq >= NR_IRQS) { 613 if (irq >= nr_irqs) {
614 printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq); 614 printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq);
615 615
616 return; 616 return;
@@ -628,7 +628,7 @@ void __init set_irq_probe(unsigned int irq)
628 struct irq_desc *desc; 628 struct irq_desc *desc;
629 unsigned long flags; 629 unsigned long flags;
630 630
631 if (irq >= NR_IRQS) { 631 if (irq >= nr_irqs) {
632 printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq); 632 printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq);
633 633
634 return; 634 return;
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index f4c8a03a9fbb..e9d022cf593e 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -47,6 +47,7 @@ handle_bad_irq(unsigned int irq, struct irq_desc *desc)
47 * 47 *
48 * Controller mappings for all interrupt sources: 48 * Controller mappings for all interrupt sources:
49 */ 49 */
50int nr_irqs = NR_IRQS;
50struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { 51struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
51 [0 ... NR_IRQS-1] = { 52 [0 ... NR_IRQS-1] = {
52 .status = IRQ_DISABLED, 53 .status = IRQ_DISABLED,
@@ -265,7 +266,7 @@ void early_init_irq_lock_class(void)
265{ 266{
266 int i; 267 int i;
267 268
268 for (i = 0; i < NR_IRQS; i++) 269 for (i = 0; i < nr_irqs; i++)
269 lockdep_set_class(&irq_desc[i].lock, &irq_desc_lock_class); 270 lockdep_set_class(&irq_desc[i].lock, &irq_desc_lock_class);
270} 271}
271 272
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index d363f32dba7d..d5a4333d8f1f 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -34,7 +34,7 @@ void synchronize_irq(unsigned int irq)
34 struct irq_desc *desc = irq_desc + irq; 34 struct irq_desc *desc = irq_desc + irq;
35 unsigned int status; 35 unsigned int status;
36 36
37 if (irq >= NR_IRQS) 37 if (irq >= nr_irqs)
38 return; 38 return;
39 39
40 do { 40 do {
@@ -143,7 +143,7 @@ void disable_irq_nosync(unsigned int irq)
143 struct irq_desc *desc = irq_desc + irq; 143 struct irq_desc *desc = irq_desc + irq;
144 unsigned long flags; 144 unsigned long flags;
145 145
146 if (irq >= NR_IRQS) 146 if (irq >= nr_irqs)
147 return; 147 return;
148 148
149 spin_lock_irqsave(&desc->lock, flags); 149 spin_lock_irqsave(&desc->lock, flags);
@@ -171,7 +171,7 @@ void disable_irq(unsigned int irq)
171{ 171{
172 struct irq_desc *desc = irq_desc + irq; 172 struct irq_desc *desc = irq_desc + irq;
173 173
174 if (irq >= NR_IRQS) 174 if (irq >= nr_irqs)
175 return; 175 return;
176 176
177 disable_irq_nosync(irq); 177 disable_irq_nosync(irq);
@@ -214,7 +214,7 @@ void enable_irq(unsigned int irq)
214 struct irq_desc *desc = irq_desc + irq; 214 struct irq_desc *desc = irq_desc + irq;
215 unsigned long flags; 215 unsigned long flags;
216 216
217 if (irq >= NR_IRQS) 217 if (irq >= nr_irqs)
218 return; 218 return;
219 219
220 spin_lock_irqsave(&desc->lock, flags); 220 spin_lock_irqsave(&desc->lock, flags);
@@ -290,7 +290,7 @@ int can_request_irq(unsigned int irq, unsigned long irqflags)
290{ 290{
291 struct irqaction *action; 291 struct irqaction *action;
292 292
293 if (irq >= NR_IRQS || irq_desc[irq].status & IRQ_NOREQUEST) 293 if (irq >= nr_irqs || irq_desc[irq].status & IRQ_NOREQUEST)
294 return 0; 294 return 0;
295 295
296 action = irq_desc[irq].action; 296 action = irq_desc[irq].action;
@@ -356,7 +356,7 @@ int setup_irq(unsigned int irq, struct irqaction *new)
356 int shared = 0; 356 int shared = 0;
357 int ret; 357 int ret;
358 358
359 if (irq >= NR_IRQS) 359 if (irq >= nr_irqs)
360 return -EINVAL; 360 return -EINVAL;
361 361
362 if (desc->chip == &no_irq_chip) 362 if (desc->chip == &no_irq_chip)
@@ -515,7 +515,7 @@ void free_irq(unsigned int irq, void *dev_id)
515 unsigned long flags; 515 unsigned long flags;
516 516
517 WARN_ON(in_interrupt()); 517 WARN_ON(in_interrupt());
518 if (irq >= NR_IRQS) 518 if (irq >= nr_irqs)
519 return; 519 return;
520 520
521 desc = irq_desc + irq; 521 desc = irq_desc + irq;
@@ -630,7 +630,7 @@ int request_irq(unsigned int irq, irq_handler_t handler,
630 */ 630 */
631 if ((irqflags & IRQF_SHARED) && !dev_id) 631 if ((irqflags & IRQF_SHARED) && !dev_id)
632 return -EINVAL; 632 return -EINVAL;
633 if (irq >= NR_IRQS) 633 if (irq >= nr_irqs)
634 return -EINVAL; 634 return -EINVAL;
635 if (irq_desc[irq].status & IRQ_NOREQUEST) 635 if (irq_desc[irq].status & IRQ_NOREQUEST)
636 return -EINVAL; 636 return -EINVAL;
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index a09dd29c2fd7..e5225a65a4f9 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -240,7 +240,7 @@ void init_irq_proc(void)
240 /* 240 /*
241 * Create entries for all existing IRQs. 241 * Create entries for all existing IRQs.
242 */ 242 */
243 for (i = 0; i < NR_IRQS; i++) 243 for (i = 0; i < nr_irqs; i++)
244 register_irq_proc(i); 244 register_irq_proc(i);
245} 245}
246 246
diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c
index a8046791ba2d..cba8aa5bc7f4 100644
--- a/kernel/irq/resend.c
+++ b/kernel/irq/resend.c
@@ -33,8 +33,8 @@ static void resend_irqs(unsigned long arg)
33 struct irq_desc *desc; 33 struct irq_desc *desc;
34 int irq; 34 int irq;
35 35
36 while (!bitmap_empty(irqs_resend, NR_IRQS)) { 36 while (!bitmap_empty(irqs_resend, nr_irqs)) {
37 irq = find_first_bit(irqs_resend, NR_IRQS); 37 irq = find_first_bit(irqs_resend, nr_irqs);
38 clear_bit(irq, irqs_resend); 38 clear_bit(irq, irqs_resend);
39 desc = irq_desc + irq; 39 desc = irq_desc + irq;
40 local_irq_disable(); 40 local_irq_disable();
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index 19fe9d6ebfe8..e26ca1e90c08 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -91,7 +91,7 @@ static int misrouted_irq(int irq)
91 int i; 91 int i;
92 int ok = 0; 92 int ok = 0;
93 93
94 for (i = 1; i < NR_IRQS; i++) { 94 for (i = 1; i < nr_irqs; i++) {
95 struct irq_desc *desc = irq_desc + i; 95 struct irq_desc *desc = irq_desc + i;
96 96
97 if (i == irq) /* Already tried */ 97 if (i == irq) /* Already tried */
@@ -107,7 +107,7 @@ static int misrouted_irq(int irq)
107static void poll_spurious_irqs(unsigned long dummy) 107static void poll_spurious_irqs(unsigned long dummy)
108{ 108{
109 int i; 109 int i;
110 for (i = 1; i < NR_IRQS; i++) { 110 for (i = 1; i < nr_irqs; i++) {
111 struct irq_desc *desc = irq_desc + i; 111 struct irq_desc *desc = irq_desc + i;
112 unsigned int status; 112 unsigned int status;
113 113