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>
This commit is contained in:
Yinghai Lu
2008-08-19 20:50:11 -07:00
committed by Ingo Molnar
parent 9059d8fa4a
commit 2c6927a38f
7 changed files with 25 additions and 26 deletions

View File

@@ -202,9 +202,16 @@ extern struct irq_desc irq_desc[NR_IRQS];
extern struct irq_desc *irq_desc;
#endif
#ifdef CONFIG_GENERIC_HARDIRQS
#define for_each_irq_desc(irq, desc) \
for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc = &irq_desc[irq])
#endif
#else
extern struct irq_desc *sparse_irqs;
#define for_each_irq_desc(irqX, desc) \
for (desc = sparse_irqs, irqX = desc->irq; desc && irqX != -1U; desc = desc->next, irqX = desc ? desc->irq : -1U)
#endif