blob: 5504a5c97836d9fb4f1fb191cd6a11cdc131c22e [file] [log] [blame]
Thomas Gleixnerdd3a1db2008-10-16 18:20:58 +02001#ifndef _LINUX_IRQNR_H
2#define _LINUX_IRQNR_H
3
Ingo Molnar0ebb26e2008-12-12 11:26:39 +01004/*
5 * Generic irq_desc iterators:
6 */
7#ifdef __KERNEL__
8
Thomas Gleixnerdd3a1db2008-10-16 18:20:58 +02009#ifndef CONFIG_GENERIC_HARDIRQS
10#include <asm/irq.h>
11# define nr_irqs NR_IRQS
12
13# define for_each_irq_desc(irq, desc) \
14 for (irq = 0; irq < nr_irqs; irq++)
Thomas Gleixnerdd3a1db2008-10-16 18:20:58 +020015
Yinghai Lu240d3672008-12-08 14:06:17 -080016# define for_each_irq_desc_reverse(irq, desc) \
17 for (irq = nr_irqs - 1; irq >= 0; irq--)
KOSAKI Motohirof9af0e72008-12-26 12:24:24 +090018#else /* CONFIG_GENERIC_HARDIRQS */
Ingo Molnar0ebb26e2008-12-12 11:26:39 +010019
20extern int nr_irqs;
KOSAKI Motohirof9af0e72008-12-26 12:24:24 +090021extern struct irq_desc *irq_to_desc(unsigned int irq);
Ingo Molnar0ebb26e2008-12-12 11:26:39 +010022
KOSAKI Motohirof9af0e72008-12-26 12:24:24 +090023# define for_each_irq_desc(irq, desc) \
24 for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \
KOSAKI Motohiro18eefed2008-12-26 12:29:48 +090025 irq++, desc = irq_to_desc(irq)) \
26 if (desc)
27
28
KOSAKI Motohirof9af0e72008-12-26 12:24:24 +090029# define for_each_irq_desc_reverse(irq, desc) \
30 for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \
KOSAKI Motohiro18eefed2008-12-26 12:29:48 +090031 irq--, desc = irq_to_desc(irq)) \
32 if (desc)
Yinghai Lu240d3672008-12-08 14:06:17 -080033
KOSAKI Motohirof9af0e72008-12-26 12:24:24 +090034#endif /* CONFIG_GENERIC_HARDIRQS */
Yinghai Lu240d3672008-12-08 14:06:17 -080035
36#define for_each_irq_nr(irq) \
37 for (irq = 0; irq < nr_irqs; irq++)
Thomas Gleixnerdd3a1db2008-10-16 18:20:58 +020038
Ingo Molnar0ebb26e2008-12-12 11:26:39 +010039#endif /* __KERNEL__ */
40
Thomas Gleixnerdd3a1db2008-10-16 18:20:58 +020041#endif