blob: 9669bf9d4f48fa38381f6c5f931b6579fc10a800 [file] [log] [blame]
Thomas Gleixnerdd3a1db2008-10-16 18:20:58 +02001#ifndef _LINUX_IRQNR_H
2#define _LINUX_IRQNR_H
3
David Howells607ca462012-10-13 10:46:48 +01004#include <uapi/linux/irqnr.h>
5
Ingo Molnar0ebb26e2008-12-12 11:26:39 +01006
Ingo Molnar0ebb26e2008-12-12 11:26:39 +01007extern int nr_irqs;
KOSAKI Motohirof9af0e72008-12-26 12:24:24 +09008extern struct irq_desc *irq_to_desc(unsigned int irq);
Thomas Gleixnera98d24b2010-09-30 10:45:07 +02009unsigned int irq_get_next_irq(unsigned int offset);
Ingo Molnar0ebb26e2008-12-12 11:26:39 +010010
KOSAKI Motohirof9af0e72008-12-26 12:24:24 +090011# define for_each_irq_desc(irq, desc) \
12 for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \
KOSAKI Motohiro18eefed2008-12-26 12:29:48 +090013 irq++, desc = irq_to_desc(irq)) \
KOSAKI Motohiro01d07822009-01-04 03:11:05 +090014 if (!desc) \
15 ; \
16 else
KOSAKI Motohiro18eefed2008-12-26 12:29:48 +090017
18
KOSAKI Motohirof9af0e72008-12-26 12:24:24 +090019# define for_each_irq_desc_reverse(irq, desc) \
20 for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \
KOSAKI Motohiro18eefed2008-12-26 12:29:48 +090021 irq--, desc = irq_to_desc(irq)) \
KOSAKI Motohiro01d07822009-01-04 03:11:05 +090022 if (!desc) \
23 ; \
24 else
Yinghai Lu240d3672008-12-08 14:06:17 -080025
Thomas Gleixnera98d24b2010-09-30 10:45:07 +020026# 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
Yinghai Lu240d3672008-12-08 14:06:17 -080030#define for_each_irq_nr(irq) \
31 for (irq = 0; irq < nr_irqs; irq++)
Thomas Gleixnerdd3a1db2008-10-16 18:20:58 +020032
Thomas Gleixnerdd3a1db2008-10-16 18:20:58 +020033#endif