aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/irqnr.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/irqnr.h')
-rw-r--r--include/linux/irqnr.h33
1 files changed, 25 insertions, 8 deletions
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h
index 452c280c8115..5504a5c97836 100644
--- a/include/linux/irqnr.h
+++ b/include/linux/irqnr.h
@@ -1,24 +1,41 @@
1#ifndef _LINUX_IRQNR_H 1#ifndef _LINUX_IRQNR_H
2#define _LINUX_IRQNR_H 2#define _LINUX_IRQNR_H
3 3
4/*
5 * Generic irq_desc iterators:
6 */
7#ifdef __KERNEL__
8
4#ifndef CONFIG_GENERIC_HARDIRQS 9#ifndef CONFIG_GENERIC_HARDIRQS
5#include <asm/irq.h> 10#include <asm/irq.h>
6# define nr_irqs NR_IRQS 11# define nr_irqs NR_IRQS
7 12
8# define for_each_irq_desc(irq, desc) \ 13# define for_each_irq_desc(irq, desc) \
9 for (irq = 0; irq < nr_irqs; irq++) 14 for (irq = 0; irq < nr_irqs; irq++)
10#else 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
11extern int nr_irqs; 20extern int nr_irqs;
21extern 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 if (desc)
12 27
13# define for_each_irq_desc(irq, desc) \
14 for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++)
15 28
16# define for_each_irq_desc_reverse(irq, desc) \ 29# define for_each_irq_desc_reverse(irq, desc) \
17 for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \ 30 for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \
18 irq >= 0; irq--, desc--) 31 irq--, desc = irq_to_desc(irq)) \
19#endif 32 if (desc)
20 33
21#define for_each_irq_nr(irq) \ 34#endif /* CONFIG_GENERIC_HARDIRQS */
22 for (irq = 0; irq < nr_irqs; irq++) 35
36#define for_each_irq_nr(irq) \
37 for (irq = 0; irq < nr_irqs; irq++)
38
39#endif /* __KERNEL__ */
23 40
24#endif 41#endif