Use the allocator bitmap to lookup active interrupts. Signed-off-by: Thomas Gleixner --- include/linux/irqnr.h | 5 +++++ kernel/irq/irqdesc.c | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) Index: linux-2.6-tip/include/linux/irqnr.h =================================================================== --- linux-2.6-tip.orig/include/linux/irqnr.h +++ linux-2.6-tip/include/linux/irqnr.h @@ -25,6 +25,7 @@ extern int nr_irqs; extern struct irq_desc *irq_to_desc(unsigned int irq); +unsigned int irq_get_next_irq(unsigned int offset); # define for_each_irq_desc(irq, desc) \ for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \ @@ -47,6 +48,10 @@ extern struct irq_desc *irq_to_desc(unsi #define irq_node(irq) 0 #endif +# define for_each_active_irq(irq) \ + for (irq = irq_get_next_irq(0); irq < nr_irqs; \ + irq = irq_get_next_irq(irq)) + #endif /* CONFIG_GENERIC_HARDIRQS */ #define for_each_irq_nr(irq) \ Index: linux-2.6-tip/kernel/irq/irqdesc.c =================================================================== --- linux-2.6-tip.orig/kernel/irq/irqdesc.c +++ linux-2.6-tip/kernel/irq/irqdesc.c @@ -470,6 +470,23 @@ err: return ret; } +/** + * irq_get_next_irq - get next allocated irq number + * @offset: where to start the search + * + * Returns next irq number after offset or nr_irqs if none is found. + */ +unsigned int irq_get_next_irq(unsigned int offset) +{ + unsigned long flags; + unsigned int res; + + raw_spin_lock_irqsave(&sparse_irq_lock, flags); + res = find_next_bit_set(allocated_irqs, nr_irqs, offset); + raw_spin_unlock_irqsave(&sparse_irq_lock, flags); + return res; +} + /* Statistics access */ void clear_kstat_irqs(struct irq_desc *desc) { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/