Commit 18eefedfe8ad33e8fc7614c13359e29a9fab4644

Authored by KOSAKI Motohiro
Committed by Ingo Molnar
1 parent 26ddd8d5ca

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>

Showing 6 changed files with 6 additions and 38 deletions Side-by-side Diff

arch/x86/kernel/io_apic.c
... ... @@ -1345,8 +1345,6 @@
1345 1345  
1346 1346 /* Mark the inuse vectors */
1347 1347 for_each_irq_desc(irq, desc) {
1348   - if (!desc)
1349   - continue;
1350 1348 cfg = desc->chip_data;
1351 1349 if (!cpu_isset(cpu, cfg->domain))
1352 1350 continue;
... ... @@ -1730,8 +1728,6 @@
1730 1728 for_each_irq_desc(irq, desc) {
1731 1729 struct irq_pin_list *entry;
1732 1730  
1733   - if (!desc)
1734   - continue;
1735 1731 cfg = desc->chip_data;
1736 1732 entry = cfg->irq_2_pin;
1737 1733 if (!entry)
... ... @@ -2378,9 +2374,6 @@
2378 2374 struct irq_desc *desc;
2379 2375  
2380 2376 for_each_irq_desc(irq, desc) {
2381   - if (!desc)
2382   - continue;
2383   -
2384 2377 if (desc->status & IRQ_MOVE_PENDING) {
2385 2378 unsigned long flags;
2386 2379  
... ... @@ -2671,9 +2664,6 @@
2671 2664 * 0x80, because int 0x80 is hm, kind of importantish. ;)
2672 2665 */
2673 2666 for_each_irq_desc(irq, desc) {
2674   - if (!desc)
2675   - continue;
2676   -
2677 2667 cfg = desc->chip_data;
2678 2668 if (IO_APIC_IRQ(irq) && cfg && !cfg->vector) {
2679 2669 /*
drivers/xen/events.c
... ... @@ -142,9 +142,6 @@
142 142  
143 143 /* By default all event channels notify CPU#0. */
144 144 for_each_irq_desc(i, desc) {
145   - if (!desc)
146   - continue;
147   -
148 145 desc->affinity = cpumask_of_cpu(0);
149 146 }
150 147 #endif
include/linux/irqnr.h
... ... @@ -22,10 +22,14 @@
22 22  
23 23 # define for_each_irq_desc(irq, desc) \
24 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 29 # define for_each_irq_desc_reverse(irq, desc) \
27 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 34 #endif /* CONFIG_GENERIC_HARDIRQS */
31 35  
kernel/irq/autoprobe.c
... ... @@ -40,9 +40,6 @@
40 40 * flush such a longstanding irq before considering it as spurious.
41 41 */
42 42 for_each_irq_desc_reverse(i, desc) {
43   - if (!desc)
44   - continue;
45   -
46 43 spin_lock_irq(&desc->lock);
47 44 if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
48 45 /*
... ... @@ -71,9 +68,6 @@
71 68 * happened in the previous stage, it may have masked itself)
72 69 */
73 70 for_each_irq_desc_reverse(i, desc) {
74   - if (!desc)
75   - continue;
76   -
77 71 spin_lock_irq(&desc->lock);
78 72 if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
79 73 desc->status |= IRQ_AUTODETECT | IRQ_WAITING;
... ... @@ -92,9 +86,6 @@
92 86 * Now filter out any obviously spurious interrupts
93 87 */
94 88 for_each_irq_desc(i, desc) {
95   - if (!desc)
96   - continue;
97   -
98 89 spin_lock_irq(&desc->lock);
99 90 status = desc->status;
100 91  
... ... @@ -133,9 +124,6 @@
133 124 int i;
134 125  
135 126 for_each_irq_desc(i, desc) {
136   - if (!desc)
137   - continue;
138   -
139 127 spin_lock_irq(&desc->lock);
140 128 status = desc->status;
141 129  
... ... @@ -178,9 +166,6 @@
178 166 unsigned int status;
179 167  
180 168 for_each_irq_desc(i, desc) {
181   - if (!desc)
182   - continue;
183   -
184 169 spin_lock_irq(&desc->lock);
185 170 status = desc->status;
186 171  
... ... @@ -437,9 +437,6 @@
437 437 int i;
438 438  
439 439 for_each_irq_desc(i, desc) {
440   - if (!desc)
441   - continue;
442   -
443 440 lockdep_set_class(&desc->lock, &irq_desc_lock_class);
444 441 }
445 442 }
kernel/irq/spurious.c
... ... @@ -91,9 +91,6 @@
91 91 int i, ok = 0;
92 92  
93 93 for_each_irq_desc(i, desc) {
94   - if (!desc)
95   - continue;
96   -
97 94 if (!i)
98 95 continue;
99 96  
... ... @@ -115,8 +112,6 @@
115 112 for_each_irq_desc(i, desc) {
116 113 unsigned int status;
117 114  
118   - if (!desc)
119   - continue;
120 115 if (!i)
121 116 continue;
122 117