kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: dhylands@gmail.com (Dave Hylands)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Disabling an interrupt
Date: Wed, 2 Mar 2011 15:49:58 -0700	[thread overview]
Message-ID: <AANLkTimeKux1BSwucqmW12moF7zeH9RFeSCeGHPRpVkx@mail.gmail.com> (raw)
In-Reply-To: <4D6CB46C.4040701@gmail.com>

Hi Jacky,

Sending to the list as well.

On Tue, Mar 1, 2011 at 1:55 AM, Jacky Lam <lamshuyin@gmail.com> 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

  parent reply	other threads:[~2011-03-02 22:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-01  8:55 Disabling an interrupt Jacky Lam
2011-03-02 22:15 ` Sri Ram Vemulpali
2011-03-02 22:49 ` Dave Hylands [this message]
2011-03-03  1:26   ` Jacky Lam
2011-03-03  2:51     ` Dave Hylands

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTimeKux1BSwucqmW12moF7zeH9RFeSCeGHPRpVkx@mail.gmail.com \
    --to=dhylands@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).