aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>2008-12-25 22:29:48 -0500
committerIngo Molnar <mingo@elte.hu>2008-12-26 03:48:18 -0500
commit18eefedfe8ad33e8fc7614c13359e29a9fab4644 (patch)
treee0b7c801c27a3933137e7e4056a3bca3c3244744
parent26ddd8d5cac8a563953d5febe8c6e40909f7bce1 (diff)
irq: simplify for_each_irq_desc() usage
Impact: cleanup all for_each_irq_desc() usage point have !desc check. then its check can move into for_each_irq_desc() macro. Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Acked-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/io_apic.c10
-rw-r--r--drivers/xen/events.c3
-rw-r--r--include/linux/irqnr.h8
-rw-r--r--kernel/irq/autoprobe.c15
-rw-r--r--kernel/irq/handle.c3
-rw-r--r--kernel/irq/spurious.c5
6 files changed, 6 insertions, 38 deletions
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c
index a74887b416cc..2fe543f58ac8 100644
--- a/arch/x86/kernel/io_apic.c
+++ b/arch/x86/kernel/io_apic.c
@@ -1345,8 +1345,6 @@ void __setup_vector_irq(int cpu)
1345 1345
1346 /* Mark the inuse vectors */ 1346 /* Mark the inuse vectors */
1347 for_each_irq_desc(irq, desc) { 1347 for_each_irq_desc(irq, desc) {
1348 if (!desc)
1349 continue;
1350 cfg = desc->chip_data; 1348 cfg = desc->chip_data;
1351 if (!cpu_isset(cpu, cfg->domain)) 1349 if (!cpu_isset(cpu, cfg->domain))
1352 continue; 1350 continue;
@@ -1730,8 +1728,6 @@ __apicdebuginit(void) print_IO_APIC(void)
1730 for_each_irq_desc(irq, desc) { 1728 for_each_irq_desc(irq, desc) {
1731 struct irq_pin_list *entry; 1729 struct irq_pin_list *entry;
1732 1730
1733 if (!desc)
1734 continue;
1735 cfg = desc->chip_data; 1731 cfg = desc->chip_data;
1736 entry = cfg->irq_2_pin; 1732 entry = cfg->irq_2_pin;
1737 if (!entry) 1733 if (!entry)
@@ -2378,9 +2374,6 @@ static void ir_irq_migration(struct work_struct *work)
2378 struct irq_desc *desc; 2374 struct irq_desc *desc;
2379 2375
2380 for_each_irq_desc(irq, desc) { 2376 for_each_irq_desc(irq, desc) {
2381 if (!desc)
2382 continue;
2383
2384 if (desc->status & IRQ_MOVE_PENDING) { 2377 if (desc->status & IRQ_MOVE_PENDING) {
2385 unsigned long flags; 2378 unsigned long flags;
2386 2379
@@ -2671,9 +2664,6 @@ static inline void init_IO_APIC_traps(void)
2671 * 0x80, because int 0x80 is hm, kind of importantish. ;) 2664 * 0x80, because int 0x80 is hm, kind of importantish. ;)
2672 */ 2665 */
2673 for_each_irq_desc(irq, desc) { 2666 for_each_irq_desc(irq, desc) {
2674 if (!desc)
2675 continue;
2676
2677 cfg = desc->chip_data; 2667 cfg = desc->chip_data;
2678 if (IO_APIC_IRQ(irq) && cfg && !cfg->vector) { 2668 if (IO_APIC_IRQ(irq) && cfg && !cfg->vector) {
2679 /* 2669 /*
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 46625cd38743..e26733a9df21 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -142,9 +142,6 @@ static void init_evtchn_cpu_bindings(void)
142 142
143 /* By default all event channels notify CPU#0. */ 143 /* By default all event channels notify CPU#0. */
144 for_each_irq_desc(i, desc) { 144 for_each_irq_desc(i, desc) {
145 if (!desc)
146 continue;
147
148 desc->affinity = cpumask_of_cpu(0); 145 desc->affinity = cpumask_of_cpu(0);
149 } 146 }
150#endif 147#endif
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h
index c4a59c7a478b..5504a5c97836 100644
--- a/include/linux/irqnr.h
+++ b/include/linux/irqnr.h
@@ -22,10 +22,14 @@ extern struct irq_desc *irq_to_desc(unsigned int irq);
22 22
23# define for_each_irq_desc(irq, desc) \ 23# define for_each_irq_desc(irq, desc) \
24 for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \ 24 for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \
25 irq++, desc = irq_to_desc(irq)) 25 irq++, desc = irq_to_desc(irq)) \
26 if (desc)
27
28
26# define for_each_irq_desc_reverse(irq, desc) \ 29# define for_each_irq_desc_reverse(irq, desc) \
27 for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \ 30 for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \
28 irq--, desc = irq_to_desc(irq)) 31 irq--, desc = irq_to_desc(irq)) \
32 if (desc)
29 33
30#endif /* CONFIG_GENERIC_HARDIRQS */ 34#endif /* CONFIG_GENERIC_HARDIRQS */
31 35
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c
index 650ce4102a63..cc0f7321b8ce 100644
--- a/kernel/irq/autoprobe.c
+++ b/kernel/irq/autoprobe.c
@@ -40,9 +40,6 @@ unsigned long probe_irq_on(void)
40 * flush such a longstanding irq before considering it as spurious. 40 * flush such a longstanding irq before considering it as spurious.
41 */ 41 */
42 for_each_irq_desc_reverse(i, desc) { 42 for_each_irq_desc_reverse(i, desc) {
43 if (!desc)
44 continue;
45
46 spin_lock_irq(&desc->lock); 43 spin_lock_irq(&desc->lock);
47 if (!desc->action && !(desc->status & IRQ_NOPROBE)) { 44 if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
48 /* 45 /*
@@ -71,9 +68,6 @@ unsigned long probe_irq_on(void)
71 * happened in the previous stage, it may have masked itself) 68 * happened in the previous stage, it may have masked itself)
72 */ 69 */
73 for_each_irq_desc_reverse(i, desc) { 70 for_each_irq_desc_reverse(i, desc) {
74 if (!desc)
75 continue;
76
77 spin_lock_irq(&desc->lock); 71 spin_lock_irq(&desc->lock);
78 if (!desc->action && !(desc->status & IRQ_NOPROBE)) { 72 if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
79 desc->status |= IRQ_AUTODETECT | IRQ_WAITING; 73 desc->status |= IRQ_AUTODETECT | IRQ_WAITING;
@@ -92,9 +86,6 @@ unsigned long probe_irq_on(void)
92 * Now filter out any obviously spurious interrupts 86 * Now filter out any obviously spurious interrupts
93 */ 87 */
94 for_each_irq_desc(i, desc) { 88 for_each_irq_desc(i, desc) {
95 if (!desc)
96 continue;
97
98 spin_lock_irq(&desc->lock); 89 spin_lock_irq(&desc->lock);
99 status = desc->status; 90 status = desc->status;
100 91
@@ -133,9 +124,6 @@ unsigned int probe_irq_mask(unsigned long val)
133 int i; 124 int i;
134 125
135 for_each_irq_desc(i, desc) { 126 for_each_irq_desc(i, desc) {
136 if (!desc)
137 continue;
138
139 spin_lock_irq(&desc->lock); 127 spin_lock_irq(&desc->lock);
140 status = desc->status; 128 status = desc->status;
141 129
@@ -178,9 +166,6 @@ int probe_irq_off(unsigned long val)
178 unsigned int status; 166 unsigned int status;
179 167
180 for_each_irq_desc(i, desc) { 168 for_each_irq_desc(i, desc) {
181 if (!desc)
182 continue;
183
184 spin_lock_irq(&desc->lock); 169 spin_lock_irq(&desc->lock);
185 status = desc->status; 170 status = desc->status;
186 171
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 03479dfdebb8..7dbdfe524693 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -437,9 +437,6 @@ void early_init_irq_lock_class(void)
437 int i; 437 int i;
438 438
439 for_each_irq_desc(i, desc) { 439 for_each_irq_desc(i, desc) {
440 if (!desc)
441 continue;
442
443 lockdep_set_class(&desc->lock, &irq_desc_lock_class); 440 lockdep_set_class(&desc->lock, &irq_desc_lock_class);
444 } 441 }
445} 442}
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index 3738107531fd..dd364c11e56e 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -91,9 +91,6 @@ static int misrouted_irq(int irq)
91 int i, ok = 0; 91 int i, ok = 0;
92 92
93 for_each_irq_desc(i, desc) { 93 for_each_irq_desc(i, desc) {
94 if (!desc)
95 continue;
96
97 if (!i) 94 if (!i)
98 continue; 95 continue;
99 96
@@ -115,8 +112,6 @@ static void poll_spurious_irqs(unsigned long dummy)
115 for_each_irq_desc(i, desc) { 112 for_each_irq_desc(i, desc) {
116 unsigned int status; 113 unsigned int status;
117 114
118 if (!desc)
119 continue;
120 if (!i) 115 if (!i)
121 continue; 116 continue;
122 117