diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-10-16 08:19:04 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-16 10:53:30 -0400 |
commit | 10e580842ec8e53dddf62e1ab1871f4906477376 (patch) | |
tree | 5793b45755f21f578ff4b06a3a3546b3de5eb8f4 /kernel | |
parent | 2be3b52a5785a6a5c5349fbd315f57595f7074be (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')
-rw-r--r-- | kernel/irq/autoprobe.c | 45 | ||||
-rw-r--r-- | kernel/irq/handle.c | 5 |
2 files changed, 15 insertions, 35 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); | |||
30 | unsigned long probe_irq_on(void) | 30 | unsigned 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 | */ |
133 | unsigned int probe_irq_mask(unsigned long val) | 120 | unsigned 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); | |||
180 | int probe_irq_off(unsigned long val) | 162 | int 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 | ||
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index a69368ff607f..c815b42d0f5b 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -268,9 +268,10 @@ static struct lock_class_key irq_desc_lock_class; | |||
268 | 268 | ||
269 | void early_init_irq_lock_class(void) | 269 | void early_init_irq_lock_class(void) |
270 | { | 270 | { |
271 | struct irq_desc *desc; | ||
271 | int i; | 272 | int i; |
272 | 273 | ||
273 | for (i = 0; i < nr_irqs; i++) | 274 | for_each_irq_desc(i, desc) |
274 | lockdep_set_class(&irq_desc[i].lock, &irq_desc_lock_class); | 275 | lockdep_set_class(&desc->lock, &irq_desc_lock_class); |
275 | } | 276 | } |
276 | #endif | 277 | #endif |