public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Marcos Lois Bermúdez" <marcos.discalis@gmail.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Question about using new request_threaded_irq
Date: Mon, 17 Dec 2012 17:06:43 +0100	[thread overview]
Message-ID: <50CF4313.1010706@gmail.com> (raw)
In-Reply-To: <20121217083759.0cbed418@lwn.net>

Hi,

I lot of thanks for you fast reply. It seem that i swap the mean of 
handler parameters, so i now see it correct. :).

Excuse for my newbie question.

handler is the primary handler, and if NULL a default primary handler is 
installed, and thread_fn is the thread handler.

I'm a bit confusing because i see a outdated page that talks about this 
new IRQ API, but now i see that it's very outdated:

http://lwn.net/Articles/302043/

Regards.


El 17/12/2012 16:37, Jonathan Corbet escribió:
> On Mon, 17 Dec 2012 16:11:22 +0100
> Marcos Lois Bermúdez <marcos.discalis@gmail.com> wrote:
>
>> For my understand if i call for example:
>>
>> request_threaded_irq(irqmum, NULL, irq_handle, IRQF_TRIGGER_FALLING,
>> DEVICE_NAME, priv);
>>
>> This seem to make a old Hard IRQ handler, and inside of this handler
>> sleep APIs can't be used, but i see some SPI drivers that seem to
>> register a IRQ of this form and make API calls that can sleep in the
>> handler.
>
> Not quite.  The prototype for request_threaded_irq() is:
>
> int request_threaded_irq(unsigned int irq, irq_handler_t handler,
> 			 irq_handler_t thread_fn, unsigned long irqflags,
> 			 const char *devname, void *dev_id)
>
> Note the presents of *two* handlers, called "handler" and "thread_fn".
> The first, "handler", is called in interrupt context; it's job is usually
> to quiet the device and return; it cannot sleep.  If it's return value is
> IRQ_WAKE_THREAD, the thread_fn() will be called in process context; it
> *can* sleep.  In the example you cite, there is no immediate handler, only
> the thread_fn(); the call to a blocking function from within the
> thread_fn() is correct.
>
> Hope that helps,
>
> jon
>
> Jonathan Corbet / LWN.net / corbet@lwn.net
>


  reply	other threads:[~2012-12-17 16:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17 15:11 Question about using new request_threaded_irq Marcos Lois Bermúdez
2012-12-17 15:37 ` Jonathan Corbet
2012-12-17 16:06   ` Marcos Lois Bermúdez [this message]
2012-12-17 17:14     ` Jonathan Corbet

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=50CF4313.1010706@gmail.com \
    --to=marcos.discalis@gmail.com \
    --cc=corbet@lwn.net \
    --cc=linux-kernel@vger.kernel.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