summaryrefslogtreecommitdiffstats
path: root/kernel/irq/autoprobe.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-10-16 14:19:04 +0200
committerIngo Molnar <mingo@elte.hu>2008-10-16 16:53:30 +0200
commit10e580842ec8e53dddf62e1ab1871f4906477376 (patch)
tree5793b45755f21f578ff4b06a3a3546b3de5eb8f4 /kernel/irq/autoprobe.c
parent2be3b52a5785a6a5c5349fbd315f57595f7074be (diff)
downloadlinux-10e580842ec8e53dddf62e1ab1871f4906477376.tar.bz2
genirq: use iterators for irq_desc loops
Use for_each_irq_desc[_reverse] for all the iteration loops. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/irq/autoprobe.c')
-rw-r--r--kernel/irq/autoprobe.c45
1 files changed, 12 insertions, 33 deletions
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c
index b3a5549ea81e..0cbff18efb6d 100644
--- a/kernel/irq/autoprobe.c
+++ b/kernel/irq/autoprobe.c
@@ -30,19 +30,16 @@ static DEFINE_MUTEX(probing_active);
unsigned long probe_irq_on(void)
{
struct irq_desc *desc;
- unsigned long mask;
- unsigned int i;
+ unsigned long mask = 0;
+ unsigned int status;
+ int i;
mutex_lock(&probing_active);
/*
* something may have generated an irq long ago and we want to
* flush such a longstanding irq before considering it as spurious.
*/
- for (i = nr_irqs-1; i > 0; i--) {
- desc = irq_to_desc(i);
- if (!desc)
- continue;
-
+ for_each_irq_desc_reverse(i, desc) {
spin_lock_irq(&desc->lock);
if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
/*
@@ -70,11 +67,7 @@ unsigned long probe_irq_on(void)
* (we must startup again here because if a longstanding irq
* happened in the previous stage, it may have masked itself)
*/
- for (i = nr_irqs-1; i > 0; i--) {
- desc = irq_to_desc(i);
- if (!desc)
- continue;
-
+ for_each_irq_desc_reverse(i, desc) {
spin_lock_irq(&desc->lock);
if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
desc->status |= IRQ_AUTODETECT | IRQ_WAITING;
@@ -92,13 +85,7 @@ unsigned long probe_irq_on(void)
/*
* Now filter out any obviously spurious interrupts
*/
- mask = 0;
- for (i = 0; i < nr_irqs; i++) {
- unsigned int status;
-
- desc = irq_to_desc(i);
- if (!desc)
- continue;
+ for_each_irq_desc(i, desc) {
spin_lock_irq(&desc->lock);
status = desc->status;
@@ -132,16 +119,11 @@ EXPORT_SYMBOL(probe_irq_on);
*/
unsigned int probe_irq_mask(unsigned long val)
{
- unsigned int mask;
+ unsigned int status, mask = 0;
+ struct irq_desc *desc;
int i;
- mask = 0;
- for (i = 0; i < nr_irqs; i++) {
- struct irq_desc *desc = irq_to_desc(i);
- unsigned int status;
-
- if (!desc)
- continue;
+ for_each_irq_desc(i, desc) {
spin_lock_irq(&desc->lock);
status = desc->status;
@@ -180,13 +162,10 @@ EXPORT_SYMBOL(probe_irq_mask);
int probe_irq_off(unsigned long val)
{
int i, irq_found = 0, nr_irqs = 0;
+ struct irq_desc *desc;
+ unsigned int status;
- for (i = 0; i < nr_irqs; i++) {
- struct irq_desc *desc = irq_to_desc(i);
- unsigned int status;
-
- if (!desc)
- continue;
+ for_each_irq_desc(i, desc) {
spin_lock_irq(&desc->lock);
status = desc->status;