Merge tag 'for-linus' of git://linux-c6x.org/git/projects/linux-c6x-upstreaming
[platform/adaptation/renesas_rcar/renesas_kernel.git] / include / linux / irqnr.h
1 #ifndef _LINUX_IRQNR_H
2 #define _LINUX_IRQNR_H
3
4 #include <uapi/linux/irqnr.h>
5
6
7 extern int nr_irqs;
8 extern struct irq_desc *irq_to_desc(unsigned int irq);
9 unsigned int irq_get_next_irq(unsigned int offset);
10
11 # define for_each_irq_desc(irq, desc)                                   \
12         for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs;           \
13              irq++, desc = irq_to_desc(irq))                            \
14                 if (!desc)                                              \
15                         ;                                               \
16                 else
17
18
19 # define for_each_irq_desc_reverse(irq, desc)                           \
20         for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0;      \
21              irq--, desc = irq_to_desc(irq))                            \
22                 if (!desc)                                              \
23                         ;                                               \
24                 else
25
26 #ifdef CONFIG_SMP
27 #define irq_node(irq)   (irq_get_irq_data(irq)->node)
28 #else
29 #define irq_node(irq)   0
30 #endif
31
32 # define for_each_active_irq(irq)                       \
33         for (irq = irq_get_next_irq(0); irq < nr_irqs;  \
34              irq = irq_get_next_irq(irq + 1))
35
36 #define for_each_irq_nr(irq)                   \
37        for (irq = 0; irq < nr_irqs; irq++)
38
39 #endif