aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq/autoprobe.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-10-16 08:19:04 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-16 10:53:30 -0400
commit10e580842ec8e53dddf62e1ab1871f4906477376 (patch)
tree5793b45755f21f578ff4b06a3a3546b3de5eb8f4 /kernel/irq/autoprobe.c
parent2be3b52a5785a6a5c5349fbd315f57595f7074be (diff)
genirq: use iterators for irq_desc loops
Use for_each_irq_desc[_reverse] for all the iteration loops. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/irq/autoprobe.c')
-rw-r--r--kernel/irq/autoprobe.c45
1 files changed, 12 insertions, 33 deletions
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c
index b3a5549ea81e..0cbff18efb6d 100644
--- a/kernel/irq/autoprobe.c
+++ b/kernel/irq/autoprobe.c
@@ -30,19 +30,16 @@ static DEFINE_MUTEX(probing_active);
30unsigned long probe_irq_on(void) 30unsigned long probe_irq_on(void)
31{ 31{
32 struct irq_desc *desc; 32 struct irq_desc *desc;
33 unsigned long mask; 33 unsigned long mask = 0;
34 unsigned int i; 34 unsigned int status;
35 int i;
35 36
36 mutex_lock(&probing_active); 37 mutex_lock(&probing_active);
37 /* 38 /*
38 * something may have generated an irq long ago and we want to 39 * something may have generated an irq long ago and we want to
39 * flush such a longstanding irq before considering it as spurious. 40 * flush such a longstanding irq before considering it as spurious.
40 */ 41 */
41 for (i = nr_irqs-1; i > 0; i--) { 42 for_each_irq_desc_reverse(i, desc) {
42 desc = irq_to_desc(i);
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 /*
@@ -70,11 +67,7 @@ unsigned long probe_irq_on(void)
70 * (we must startup again here because if a longstanding irq 67 * (we must startup again here because if a longstanding irq
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 (i = nr_irqs-1; i > 0; i--) { 70 for_each_irq_desc_reverse(i, desc) {
74 desc = irq_to_desc(i);
75 if (!desc)
76 continue;
77
78 spin_lock_irq(&desc->lock); 71 spin_lock_irq(&desc->lock);
79 if (!desc->action && !(desc->status & IRQ_NOPROBE)) { 72 if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
80 desc->status |= IRQ_AUTODETECT | IRQ_WAITING; 73 desc->status |= IRQ_AUTODETECT | IRQ_WAITING;
@@ -92,13 +85,7 @@ unsigned long probe_irq_on(void)
92 /* 85 /*
93 * Now filter out any obviously spurious interrupts 86 * Now filter out any obviously spurious interrupts
94 */ 87 */
95 mask = 0; 88 for_each_irq_desc(i, desc) {
96 for (i = 0; i < nr_irqs; i++) {
97 unsigned int status;
98
99 desc = irq_to_desc(i);
100 if (!desc)
101 continue;
102 spin_lock_irq(&desc->lock); 89 spin_lock_irq(&desc->lock);
103 status = desc->status; 90 status = desc->status;
104 91
@@ -132,16 +119,11 @@ EXPORT_SYMBOL(probe_irq_on);
132 */ 119 */
133unsigned int probe_irq_mask(unsigned long val) 120unsigned int probe_irq_mask(unsigned long val)
134{ 121{
135 unsigned int mask; 122 unsigned int status, mask = 0;
123 struct irq_desc *desc;
136 int i; 124 int i;
137 125
138 mask = 0; 126 for_each_irq_desc(i, desc) {
139 for (i = 0; i < nr_irqs; i++) {
140 struct irq_desc *desc = irq_to_desc(i);
141 unsigned int status;
142
143 if (!desc)
144 continue;
145 spin_lock_irq(&desc->lock); 127 spin_lock_irq(&desc->lock);
146 status = desc->status; 128 status = desc->status;
147 129
@@ -180,13 +162,10 @@ EXPORT_SYMBOL(probe_irq_mask);
180int probe_irq_off(unsigned long val) 162int probe_irq_off(unsigned long val)
181{ 163{
182 int i, irq_found = 0, nr_irqs = 0; 164 int i, irq_found = 0, nr_irqs = 0;
165 struct irq_desc *desc;
166 unsigned int status;
183 167
184 for (i = 0; i < nr_irqs; i++) { 168 for_each_irq_desc(i, desc) {
185 struct irq_desc *desc = irq_to_desc(i);
186 unsigned int status;
187
188 if (!desc)
189 continue;
190 spin_lock_irq(&desc->lock); 169 spin_lock_irq(&desc->lock);
191 status = desc->status; 170 status = desc->status;
192 171