Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-btrfs-devel.git] / include / linux / irqnr.h
blob3bc4dcab6e828a16b6113c1aa1f3de08bb062c46
1 #ifndef _LINUX_IRQNR_H
2 #define _LINUX_IRQNR_H
4 /*
5 * Generic irq_desc iterators:
6 */
7 #ifdef __KERNEL__
9 #ifndef CONFIG_GENERIC_HARDIRQS
10 #include <asm/irq.h>
13 * Wrappers for non-genirq architectures:
15 #define nr_irqs NR_IRQS
16 #define irq_to_desc(irq) (&irq_desc[irq])
18 # define for_each_irq_desc(irq, desc) \
19 for (irq = 0; irq < nr_irqs; irq++)
21 # define for_each_irq_desc_reverse(irq, desc) \
22 for (irq = nr_irqs - 1; irq >= 0; irq--)
24 #else /* CONFIG_GENERIC_HARDIRQS */
26 extern int nr_irqs;
27 extern struct irq_desc *irq_to_desc(unsigned int irq);
28 unsigned int irq_get_next_irq(unsigned int offset);
30 # define for_each_irq_desc(irq, desc) \
31 for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \
32 irq++, desc = irq_to_desc(irq)) \
33 if (!desc) \
34 ; \
35 else
38 # define for_each_irq_desc_reverse(irq, desc) \
39 for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \
40 irq--, desc = irq_to_desc(irq)) \
41 if (!desc) \
42 ; \
43 else
45 #ifdef CONFIG_SMP
46 #define irq_node(irq) (irq_get_irq_data(irq)->node)
47 #else
48 #define irq_node(irq) 0
49 #endif
51 # define for_each_active_irq(irq) \
52 for (irq = irq_get_next_irq(0); irq < nr_irqs; \
53 irq = irq_get_next_irq(irq + 1))
55 #endif /* CONFIG_GENERIC_HARDIRQS */
57 #define for_each_irq_nr(irq) \
58 for (irq = 0; irq < nr_irqs; irq++)
60 #endif /* __KERNEL__ */
62 #endif