Merge tag 'edac_urgent_for_4.2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.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 # define for_each_active_irq(irq)                       \
27         for (irq = irq_get_next_irq(0); irq < nr_irqs;  \
28              irq = irq_get_next_irq(irq + 1))
29
30 #define for_each_irq_nr(irq)                   \
31        for (irq = 0; irq < nr_irqs; irq++)
32
33 #endif