Threaded irq handler question

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Will Newton
Date: Wednesday, April 21, 2010 - 9:35 am

Hi all,

I have a threaded irq handler attached to a level-triggered gpio
interrupt line. The check handler checks the status of the gpio line
and disables the irq line amd returns WAKE_THREAD in that case:

static irqreturn_t isr_check(int irq, void *p)
{
        if (gpio_status()) {
                disable_irq_nosync(irq);
                return IRQ_WAKE_THREAD;
        }

        return IRQ_NONE;
}

The thread then does some i2c transactions that will eventually
deassert the gpio line:

static irqreturn_t isr(int irq, void *p)
{
        /* do some i2c transfers */
        enable_irq(irq);
        return IRQ_HANDLED;
}

My problem is that this structure does not work, because once I call
disable_irq_nosync() on the irq in the check handler the thread will
no longer run because the irq is disabled. However if I don't call
disable_irq_nosync() I will get endless irqs because the line is
level-triggered and will not be deasserted until the thread has run.

Could someone tell me what I'm doing wrong here?

Thanks,
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Threaded irq handler question, Will Newton, (Wed Apr 21, 9:35 am)
Re: Threaded irq handler question, Jonathan Corbet, (Wed Apr 21, 10:28 am)
Re: Threaded irq handler question, Yong Zhang, (Wed Apr 21, 6:37 pm)
Re: Threaded irq handler question, Will Newton, (Thu Apr 22, 3:51 am)
Re: Threaded irq handler question, Will Newton, (Thu Apr 22, 3:51 am)
Re: Threaded irq handler question, Mark Brown, (Fri Apr 23, 6:29 am)
Re: Threaded irq handler question, Mark Brown, (Fri Apr 23, 6:30 am)