[PATCHv2 02/10] ARM: vic: MULTI_IRQ_HANDLER handler

Linus Walleij linus.walleij at linaro.org
Thu Nov 3 23:29:08 EST 2011


On Wed, Nov 2, 2011 at 3:08 PM, Jamie Iles <jamie at jamieiles.com> wrote:
> On Wed, Nov 02, 2011 at 01:40:24PM +0000, Russell King - ARM Linux wrote:
>>
>> And if we receive another interrupt after the read of the register, we'll
>> have to exit all the way back (possibly to userspace) before re-entering
>> the IRQ handling paths back to this point to process it.
>
> OK, so how about something like this instead:
>
> static int vic_single_handle_irq(struct vic_device *vic,
>                                 struct pt_regs *regs)

Is it single really? This handles all active IRQs on the VIC instance.
Can it be renamed vic_handle_irq()?

> {
>        u32 stat, irq;
>        int handled = 0;
>
>        stat = readl_relaxed(vic->base + VIC_IRQ_STATUS);
>        while (stat) {
>                irq = ffs(stat) - 1;
>                handle_IRQ(irq_domain_to_irq(&vic->domain, irq), regs);
>                stat &= ~(1 << irq);
>                handled = 1;
>        }
>
>        return handled;
> }

No, if we receive another IRQ *after* the read of the register was the
question, right?

Just replace

stat &= ~(1 << irq);

with a second

stat = readl_relaxed(vic->base + VIC_IRQ_STATUS);

It'll work just fine, the IRQ line should be low when you read
it the second time, else it is probably fully proper to call
the IRQ handler again anyway.

Just my €0.01..
Linus Walleij


More information about the devicetree-discuss mailing list