Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph...
[linux-2.6.git] / include / linux / irqnr.h
blob0a2dc46cdaf6e7070dc602fcde64a23c72553361
1 #ifndef _LINUX_IRQNR_H
2 #define _LINUX_IRQNR_H
4 #include <uapi/linux/irqnr.h>
7 #ifndef CONFIG_GENERIC_HARDIRQS
8 #include <asm/irq.h>
11 * Wrappers for non-genirq architectures:
13 #define nr_irqs NR_IRQS
14 #define irq_to_desc(irq) (&irq_desc[irq])
16 # define for_each_irq_desc(irq, desc) \
17 for (irq = 0; irq < nr_irqs; irq++)
19 # define for_each_irq_desc_reverse(irq, desc) \
20 for (irq = nr_irqs - 1; irq >= 0; irq--)
22 #else /* CONFIG_GENERIC_HARDIRQS */
24 extern int nr_irqs;
25 extern struct irq_desc *irq_to_desc(unsigned int irq);
26 unsigned int irq_get_next_irq(unsigned int offset);
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 else
36 # define for_each_irq_desc_reverse(irq, desc) \
37 for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \
38 irq--, desc = irq_to_desc(irq)) \
39 if (!desc) \
40 ; \
41 else
43 #ifdef CONFIG_SMP
44 #define irq_node(irq) (irq_get_irq_data(irq)->node)
45 #else
46 #define irq_node(irq) 0
47 #endif
49 # define for_each_active_irq(irq) \
50 for (irq = irq_get_next_irq(0); irq < nr_irqs; \
51 irq = irq_get_next_irq(irq + 1))
53 #endif /* CONFIG_GENERIC_HARDIRQS */
55 #define for_each_irq_nr(irq) \
56 for (irq = 0; irq < nr_irqs; irq++)
58 #endif