Merge remote branch 'nouveau/for-airlied' into drm-next-stage
[platform/adaptation/renesas_rcar/renesas_kernel.git] / 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
24 #else /* CONFIG_GENERIC_HARDIRQS */
25
26 extern int nr_irqs;
27 extern struct irq_desc *irq_to_desc(unsigned int irq);
28
29 # define for_each_irq_desc(irq, desc)                                   \
30         for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs;           \
31              irq++, desc = irq_to_desc(irq))                            \
32                 if (!desc)                                              \
33                         ;                                               \
34                 else
35
36
37 # define for_each_irq_desc_reverse(irq, desc)                           \
38         for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0;      \
39              irq--, desc = irq_to_desc(irq))                            \
40                 if (!desc)                                              \
41                         ;                                               \
42                 else
43
44 #ifdef CONFIG_SMP
45 #define irq_node(irq)   (irq_to_desc(irq)->node)
46 #else
47 #define irq_node(irq)   0
48 #endif
49
50 #endif /* CONFIG_GENERIC_HARDIRQS */
51
52 #define for_each_irq_nr(irq)                   \
53        for (irq = 0; irq < nr_irqs; irq++)
54
55 #endif /* __KERNEL__ */
56
57 #endif