]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - include/linux/irqnr.h
irq: for_each_irq_desc() move to irqnr.h
[mirror_ubuntu-bionic-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 # define nr_irqs NR_IRQS
12
13 # define for_each_irq_desc(irq, desc) \
14 for (irq = 0; irq < nr_irqs; irq++)
15
16 # define for_each_irq_desc_reverse(irq, desc) \
17 for (irq = nr_irqs - 1; irq >= 0; irq--)
18 #else /* CONFIG_GENERIC_HARDIRQS */
19
20 extern int nr_irqs;
21 extern struct irq_desc *irq_to_desc(unsigned int irq);
22
23 # define for_each_irq_desc(irq, desc) \
24 for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \
25 irq++, desc = irq_to_desc(irq))
26 # define for_each_irq_desc_reverse(irq, desc) \
27 for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \
28 irq--, desc = irq_to_desc(irq))
29
30 #endif /* CONFIG_GENERIC_HARDIRQS */
31
32 #define for_each_irq_nr(irq) \
33 for (irq = 0; irq < nr_irqs; irq++)
34
35 #endif /* __KERNEL__ */
36
37 #endif