diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-08-19 23:50:11 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-16 10:52:33 -0400 |
commit | 2c6927a38f65b53b62f86158fba29a068c4e8b6a (patch) | |
tree | 4f23cf5689c8fbaed771219b4afd3f785d8048bc /include | |
parent | 9059d8fa4a3a9153da53da890039f7f956cc9d19 (diff) |
irq: replace loop with nr_irqs with for_each_irq_desc
There are a handful of loops that go from 0 to nr_irqs and use
get_irq_desc() on them. These would allocate all the irq_desc
entries, regardless of the need for them.
Use the smarter for_each_irq_desc() iterator that will only iterate
over the present ones.
v2: make sure arch without GENERIC_HARDIRQS work too
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/irq.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h index c9ffef7c3b44..9de16ca8b8e5 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -202,9 +202,16 @@ extern struct irq_desc irq_desc[NR_IRQS]; | |||
202 | extern struct irq_desc *irq_desc; | 202 | extern struct irq_desc *irq_desc; |
203 | #endif | 203 | #endif |
204 | 204 | ||
205 | #ifdef CONFIG_GENERIC_HARDIRQS | ||
206 | #define for_each_irq_desc(irq, desc) \ | ||
207 | for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc = &irq_desc[irq]) | ||
208 | #endif | ||
209 | |||
205 | #else | 210 | #else |
206 | 211 | ||
207 | extern struct irq_desc *sparse_irqs; | 212 | extern struct irq_desc *sparse_irqs; |
213 | #define for_each_irq_desc(irqX, desc) \ | ||
214 | for (desc = sparse_irqs, irqX = desc->irq; desc && irqX != -1U; desc = desc->next, irqX = desc ? desc->irq : -1U) | ||
208 | 215 | ||
209 | #endif | 216 | #endif |
210 | 217 | ||