2011-04-05 00:54:47

by Timur Tabi

[permalink] [raw]
Subject: Ok to call disable_irq before request_irq?

Is it okay to call disable_irq() before calling request_irq()? My
device creates lots of spurious interrupts, and so I want the
interrupt enable only when I expect a real interrupt to occur. It
seems to work, but I just want to make sure it's a proper technique.

--
Timur Tabi
Linux kernel developer at Freescale


2011-04-05 02:16:24

by Lars-Peter Clausen

[permalink] [raw]
Subject: Re: Ok to call disable_irq before request_irq?

On 04/05/2011 02:53 AM, Timur Tabi wrote:
> Is it okay to call disable_irq() before calling request_irq()? My
> device creates lots of spurious interrupts, and so I want the
> interrupt enable only when I expect a real interrupt to occur. It
> seems to work, but I just want to make sure it's a proper technique.
>

It might work in your case, but in general that would certainly be really bad
practice.
If the irq was not requested before request_irq should enable the IRQ
regardless of whether irq_disable was called or not.

I have a patch which adds the IRQF_NOAUTOEN flag, which allows you to request a
IRQ without automatically enabling it. Unfortunately the current version of the
patch will fail if your irq_chip implements the irq_startup callback. I've
attached the patch.

- Lars


Attachments:
irqf_noautoen.patch (1.64 kB)