From mboxrd@z Thu Jan 1 00:00:00 1970 From: lamshuyin@gmail.com (Jacky Lam) Date: Thu, 03 Mar 2011 09:26:26 +0800 Subject: Disabling an interrupt In-Reply-To: References: <4D6CB46C.4040701@gmail.com> Message-ID: <4D6EEE42.10909@gmail.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org Hi Dave, I have confirmed the execution has go into desc ->irq_data .chip ->irq_disable (&desc ->irq_data ); However, irq_disable points to kernel/irq/chip.c:default_disable() which do nothings. Unlike default_enable() which called by enable_irq() will unmask the IRQ accordingly. I don't understand the reason behind. BR, Jacky On 3/3/2011 6:49 AM, Dave Hylands wrote: > Hi Jacky, > > Sending to the list as well. > > On Tue, Mar 1, 2011 at 1:55 AM, Jacky Lam wrote: >> Hi, >> >> It's long before when I want to enable/disable an interrupt, I call >> enable_irq()/disable_irq(). However, recently, I do that again. >> disable_irq() do nothing. I looked into the code and find disable_irq() >> is pointing to a empty function default_disable(). This change is >> started from 2.6.20. >> >> I want to know what should I do if I want to disable an interrupt now? > So disable/enable_irq are nestable, and you're expected to call them > in the order disable/enable. > > You need to call enable_irq exactly the same number of times that you > call disable_irq. > > If you start wth inerrtupts enabled and do > enable_irq > ...do some stuff... > disable_irq > > then disable_irq will do nothing since it just decremented the count > that enable_irq incremented. > > Another way of looking at it is that disable_irq increments a count, > and enable_irq decrements a count. > The interrupt is only "really" disabled when the count transitions > from 0 to 1, and the interrupt is only "really" enabled when the count > transitions from 1 to 0. > > Dave Hylands > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110303/d0660954/attachment.html