Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
irqnr.h
Go to the documentation of this file.
1 #ifndef _LINUX_IRQNR_H
2 #define _LINUX_IRQNR_H
3 
4 #include <uapi/linux/irqnr.h>
5 
6 
7 #ifndef CONFIG_GENERIC_HARDIRQS
8 #include <asm/irq.h>
9 
10 /*
11  * Wrappers for non-genirq architectures:
12  */
13 #define nr_irqs NR_IRQS
14 #define irq_to_desc(irq) (&irq_desc[irq])
15 
16 # define for_each_irq_desc(irq, desc) \
17  for (irq = 0; irq < nr_irqs; irq++)
18 
19 # define for_each_irq_desc_reverse(irq, desc) \
20  for (irq = nr_irqs - 1; irq >= 0; irq--)
21 
22 #else /* CONFIG_GENERIC_HARDIRQS */
23 
24 extern int nr_irqs;
25 extern struct irq_desc *irq_to_desc(unsigned int irq);
26 unsigned int irq_get_next_irq(unsigned int offset);
27 
28 # define for_each_irq_desc(irq, desc) \
29  for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \
30  irq++, desc = irq_to_desc(irq)) \
31  if (!desc) \
32  ; \
33  else
34 
35 
36 # define for_each_irq_desc_reverse(irq, desc) \
37  for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \
38  irq--, desc = irq_to_desc(irq)) \
39  if (!desc) \
40  ; \
41  else
42 
43 #ifdef CONFIG_SMP
44 #define irq_node(irq) (irq_get_irq_data(irq)->node)
45 #else
46 #define irq_node(irq) 0
47 #endif
48 
49 # define for_each_active_irq(irq) \
50  for (irq = irq_get_next_irq(0); irq < nr_irqs; \
51  irq = irq_get_next_irq(irq + 1))
52 
53 #endif /* CONFIG_GENERIC_HARDIRQS */
54 
55 #define for_each_irq_nr(irq) \
56  for (irq = 0; irq < nr_irqs; irq++)
57 
58 #endif