Merge branch 'for_2.6.29' of git://git.kernel.org/pub/scm/linux/kernel/git/kkeil...
[linux-2.6] / include / linux / irqnr.h
1 #ifndef _LINUX_IRQNR_H
2 #define _LINUX_IRQNR_H
3
4 /*
5  * Generic irq_desc iterators:
6  */
7 #ifdef __KERNEL__
8
9 #ifndef CONFIG_GENERIC_HARDIRQS
10 #include <asm/irq.h>
11
12 /*
13  * Wrappers for non-genirq architectures:
14  */
15 #define nr_irqs                 NR_IRQS
16 #define irq_to_desc(irq)        (&irq_desc[irq])
17
18 # define for_each_irq_desc(irq, desc)           \
19         for (irq = 0; irq < nr_irqs; irq++)
20
21 # define for_each_irq_desc_reverse(irq, desc)                          \
22         for (irq = nr_irqs - 1; irq >= 0; irq--)
23 #else /* CONFIG_GENERIC_HARDIRQS */
24
25 extern int nr_irqs;
26 extern struct irq_desc *irq_to_desc(unsigned int irq);
27
28 # define for_each_irq_desc(irq, desc)                                   \
29         for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs;           \
30              irq++, desc = irq_to_desc(irq))                            \
31                 if (desc)
32
33
34 # define for_each_irq_desc_reverse(irq, desc)                           \
35         for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0;      \
36              irq--, desc = irq_to_desc(irq))                            \
37                 if (desc)
38
39 #endif /* CONFIG_GENERIC_HARDIRQS */
40
41 #define for_each_irq_nr(irq)                   \
42        for (irq = 0; irq < nr_irqs; irq++)
43
44 #endif /* __KERNEL__ */
45
46 #endif