Thomas Gleixner | dd3a1db | 2008-10-16 18:20:58 +0200 | [diff] [blame] | 1 | #ifndef _LINUX_IRQNR_H |
| 2 | #define _LINUX_IRQNR_H |
| 3 | |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 4 | #include <uapi/linux/irqnr.h> |
| 5 | |
Ingo Molnar | 0ebb26e | 2008-12-12 11:26:39 +0100 | [diff] [blame] | 6 | |
Thomas Gleixner | dd3a1db | 2008-10-16 18:20:58 +0200 | [diff] [blame] | 7 | #ifndef CONFIG_GENERIC_HARDIRQS |
| 8 | #include <asm/irq.h> |
Ingo Molnar | be92d7a | 2009-01-05 14:34:42 +0100 | [diff] [blame] | 9 | |
| 10 | /* |
| 11 | * Wrappers for non-genirq architectures: |
| 12 | */ |
| 13 | #define nr_irqs NR_IRQS |
| 14 | #define irq_to_desc(irq) (&irq_desc[irq]) |
Thomas Gleixner | dd3a1db | 2008-10-16 18:20:58 +0200 | [diff] [blame] | 15 | |
| 16 | # define for_each_irq_desc(irq, desc) \ |
| 17 | for (irq = 0; irq < nr_irqs; irq++) |
Thomas Gleixner | dd3a1db | 2008-10-16 18:20:58 +0200 | [diff] [blame] | 18 | |
Yinghai Lu | 240d367 | 2008-12-08 14:06:17 -0800 | [diff] [blame] | 19 | # define for_each_irq_desc_reverse(irq, desc) \ |
| 20 | for (irq = nr_irqs - 1; irq >= 0; irq--) |
Mike Travis | 9332fcc | 2009-01-10 22:24:07 -0800 | [diff] [blame] | 21 | |
KOSAKI Motohiro | f9af0e7 | 2008-12-26 12:24:24 +0900 | [diff] [blame] | 22 | #else /* CONFIG_GENERIC_HARDIRQS */ |
Ingo Molnar | 0ebb26e | 2008-12-12 11:26:39 +0100 | [diff] [blame] | 23 | |
| 24 | extern int nr_irqs; |
KOSAKI Motohiro | f9af0e7 | 2008-12-26 12:24:24 +0900 | [diff] [blame] | 25 | extern struct irq_desc *irq_to_desc(unsigned int irq); |
Thomas Gleixner | a98d24b | 2010-09-30 10:45:07 +0200 | [diff] [blame] | 26 | unsigned int irq_get_next_irq(unsigned int offset); |
Ingo Molnar | 0ebb26e | 2008-12-12 11:26:39 +0100 | [diff] [blame] | 27 | |
KOSAKI Motohiro | f9af0e7 | 2008-12-26 12:24:24 +0900 | [diff] [blame] | 28 | # define for_each_irq_desc(irq, desc) \ |
| 29 | for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \ |
KOSAKI Motohiro | 18eefed | 2008-12-26 12:29:48 +0900 | [diff] [blame] | 30 | irq++, desc = irq_to_desc(irq)) \ |
KOSAKI Motohiro | 01d0782 | 2009-01-04 03:11:05 +0900 | [diff] [blame] | 31 | if (!desc) \ |
| 32 | ; \ |
| 33 | else |
KOSAKI Motohiro | 18eefed | 2008-12-26 12:29:48 +0900 | [diff] [blame] | 34 | |
| 35 | |
KOSAKI Motohiro | f9af0e7 | 2008-12-26 12:24:24 +0900 | [diff] [blame] | 36 | # define for_each_irq_desc_reverse(irq, desc) \ |
| 37 | for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \ |
KOSAKI Motohiro | 18eefed | 2008-12-26 12:29:48 +0900 | [diff] [blame] | 38 | irq--, desc = irq_to_desc(irq)) \ |
KOSAKI Motohiro | 01d0782 | 2009-01-04 03:11:05 +0900 | [diff] [blame] | 39 | if (!desc) \ |
| 40 | ; \ |
| 41 | else |
Yinghai Lu | 240d367 | 2008-12-08 14:06:17 -0800 | [diff] [blame] | 42 | |
Yinghai Lu | 5bfb5b5 | 2009-08-26 16:20:48 -0700 | [diff] [blame] | 43 | #ifdef CONFIG_SMP |
Paul Mundt | 4600d7c | 2010-10-28 11:30:31 +0900 | [diff] [blame] | 44 | #define irq_node(irq) (irq_get_irq_data(irq)->node) |
Yinghai Lu | 5bfb5b5 | 2009-08-26 16:20:48 -0700 | [diff] [blame] | 45 | #else |
| 46 | #define irq_node(irq) 0 |
| 47 | #endif |
| 48 | |
Thomas Gleixner | a98d24b | 2010-09-30 10:45:07 +0200 | [diff] [blame] | 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 | |
KOSAKI Motohiro | f9af0e7 | 2008-12-26 12:24:24 +0900 | [diff] [blame] | 53 | #endif /* CONFIG_GENERIC_HARDIRQS */ |
Yinghai Lu | 240d367 | 2008-12-08 14:06:17 -0800 | [diff] [blame] | 54 | |
| 55 | #define for_each_irq_nr(irq) \ |
| 56 | for (irq = 0; irq < nr_irqs; irq++) |
Thomas Gleixner | dd3a1db | 2008-10-16 18:20:58 +0200 | [diff] [blame] | 57 | |
Thomas Gleixner | dd3a1db | 2008-10-16 18:20:58 +0200 | [diff] [blame] | 58 | #endif |