Skip to content

Commit

Permalink
irqchip: spear_shirq: Simplify chained handler
Browse files Browse the repository at this point in the history
I don't know if there are less efficient ways to code that. Get rid of
the loop mess and use efficient code.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20140619212713.662897061@linutronix.de
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
  • Loading branch information
Thomas Gleixner authored and Jason Cooper committed Jun 24, 2014
1 parent 97dcc21 commit 25dc49e
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions drivers/irqchip/spear-shirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,23 +224,20 @@ static void shirq_handler(unsigned irq, struct irq_desc *desc)
struct spear_shirq *shirq = irq_get_handler_data(irq);
struct irq_data *idata = irq_desc_get_irq_data(desc);
struct irq_chip *chip = irq_data_get_irq_chip(idata);
u32 i, j, val, mask;
u32 pend;

chip->irq_ack(idata);

mask = shirq->mask;
while ((val = readl(shirq->base + shirq->regs.status_reg) &
mask)) {
pend = readl(shirq->base + shirq->regs.status_reg) & shirq->mask;
pend >>= shirq->offset;

val >>= shirq->offset;
for (i = 0, j = 1; i < shirq->nr_irqs; i++, j <<= 1) {
while (pend) {
int irq = __ffs(pend);

if (!(j & val))
continue;

generic_handle_irq(shirq->virq_base + i);
}
pend &= ~(0x1 << irq);
generic_handle_irq(shirq->virq_base + irq);
}

chip->irq_unmask(idata);
}

Expand Down

0 comments on commit 25dc49e

Please sign in to comment.