Skip to content

Commit fa27271

Browse files
committed
genirq: Fixup poll handling
try_one_irq() contains redundant code and lots of useless checks for shared interrupts. Check for shared before setting IRQ_INPROGRESS and then call handle_IRQ_event() while pending. Shorter version with the same functionality. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent b738a50 commit fa27271

1 file changed

Lines changed: 19 additions & 31 deletions

File tree

‎kernel/irq/spurious.c‎

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -42,48 +42,36 @@ static int try_one_irq(int irq, struct irq_desc *desc)
4242
raw_spin_unlock(&desc->lock);
4343
return ok;
4444
}
45-
/* Honour the normal IRQ locking */
46-
desc->status |= IRQ_INPROGRESS;
47-
action = desc->action;
48-
raw_spin_unlock(&desc->lock);
49-
50-
while (action) {
51-
/* Only shared IRQ handlers are safe to call */
52-
if (action->flags & IRQF_SHARED) {
53-
if (action->handler(irq, action->dev_id) ==
54-
IRQ_HANDLED)
55-
ok = 1;
56-
}
57-
action = action->next;
58-
}
59-
local_irq_disable();
60-
/* Now clean up the flags */
61-
raw_spin_lock(&desc->lock);
62-
action = desc->action;
63-
6445
/*
65-
* While we were looking for a fixup someone queued a real
66-
* IRQ clashing with our walk:
46+
* All handlers must agree on IRQF_SHARED, so we test just the
47+
* first. Check for action->next as well.
6748
*/
68-
while ((desc->status & IRQ_PENDING) && action) {
69-
/*
70-
* Perform real IRQ processing for the IRQ we deferred
71-
*/
72-
work = 1;
49+
action = desc->action;
50+
if (!action || !(action->flags & IRQF_SHARED) || !action->next)
51+
goto out;
52+
53+
/* Honour the normal IRQ locking */
54+
desc->status |= IRQ_INPROGRESS;
55+
do {
56+
work++;
57+
desc->status &= ~IRQ_PENDING;
7358
raw_spin_unlock(&desc->lock);
74-
handle_IRQ_event(irq, action);
59+
if (handle_IRQ_event(irq, action) != IRQ_NONE)
60+
ok = 1;
7561
raw_spin_lock(&desc->lock);
76-
desc->status &= ~IRQ_PENDING;
77-
}
62+
action = desc->action;
63+
} while ((desc->status & IRQ_PENDING) && action);
64+
7865
desc->status &= ~IRQ_INPROGRESS;
7966
/*
8067
* If we did actual work for the real IRQ line we must let the
8168
* IRQ controller clean up too
8269
*/
83-
if (work)
70+
if (work > 1)
8471
irq_end(irq, desc);
85-
raw_spin_unlock(&desc->lock);
8672

73+
out:
74+
raw_spin_unlock(&desc->lock);
8775
return ok;
8876
}
8977

0 commit comments

Comments
 (0)