diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2010-09-30 04:45:07 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2010-10-12 10:39:07 -0400 |
commit | a98d24b71b6e229965f18dc00d28dc71cb8fe324 (patch) | |
tree | 213a6daf67e459b2078e630d5a8163c3b8fd3a9c | |
parent | 13bfe99e09123ef5edb6acb81ba337d2db600b53 (diff) |
genirq: Implement sane enumeration
Use the allocator bitmap to lookup active interrupts.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/linux/irqnr.h | 5 | ||||
-rw-r--r-- | kernel/irq/irqdesc.c | 11 |
2 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h index 7bf89bc8cbca..05aa8c23483f 100644 --- a/include/linux/irqnr.h +++ b/include/linux/irqnr.h | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | extern int nr_irqs; | 26 | extern int nr_irqs; |
27 | extern struct irq_desc *irq_to_desc(unsigned int irq); | 27 | extern struct irq_desc *irq_to_desc(unsigned int irq); |
28 | unsigned int irq_get_next_irq(unsigned int offset); | ||
28 | 29 | ||
29 | # define for_each_irq_desc(irq, desc) \ | 30 | # define for_each_irq_desc(irq, desc) \ |
30 | for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \ | 31 | for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \ |
@@ -47,6 +48,10 @@ extern struct irq_desc *irq_to_desc(unsigned int irq); | |||
47 | #define irq_node(irq) 0 | 48 | #define irq_node(irq) 0 |
48 | #endif | 49 | #endif |
49 | 50 | ||
51 | # define for_each_active_irq(irq) \ | ||
52 | for (irq = irq_get_next_irq(0); irq < nr_irqs; \ | ||
53 | irq = irq_get_next_irq(irq + 1)) | ||
54 | |||
50 | #endif /* CONFIG_GENERIC_HARDIRQS */ | 55 | #endif /* CONFIG_GENERIC_HARDIRQS */ |
51 | 56 | ||
52 | #define for_each_irq_nr(irq) \ | 57 | #define for_each_irq_nr(irq) \ |
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index 6312a2c83971..2e7e94ef64da 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c | |||
@@ -463,6 +463,17 @@ err: | |||
463 | return ret; | 463 | return ret; |
464 | } | 464 | } |
465 | 465 | ||
466 | /** | ||
467 | * irq_get_next_irq - get next allocated irq number | ||
468 | * @offset: where to start the search | ||
469 | * | ||
470 | * Returns next irq number after offset or nr_irqs if none is found. | ||
471 | */ | ||
472 | unsigned int irq_get_next_irq(unsigned int offset) | ||
473 | { | ||
474 | return find_next_bit(allocated_irqs, nr_irqs, offset); | ||
475 | } | ||
476 | |||
466 | /* Statistics access */ | 477 | /* Statistics access */ |
467 | void clear_kstat_irqs(struct irq_desc *desc) | 478 | void clear_kstat_irqs(struct irq_desc *desc) |
468 | { | 479 | { |