public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Marcos Lois Bermúdez" <marcos.discalis@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Question about using new request_threaded_irq
Date: Mon, 17 Dec 2012 16:11:22 +0100	[thread overview]
Message-ID: <50CF361A.1030203@gmail.com> (raw)

Hi,

I'm downloaded kernel sources 3.2.27, and now I'm writing a device 
driver for a SPI device, i make some kernel drivers in the past, so now 
I'm surfing the source tree to see the new mode to make things.

My driver need handle hardware interrupts, in the past i use 
request_irq, but now there is a request_threaded_irq that makes more 
easy to have a top / bottom processing. But I'm confuse, after read the 
inner implementation of request_threaded_irq and see some drivers that 
use it. 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. Ex: drivers/input/touchscreen/ad7877.c it register the IRQ as:

err = request_threaded_irq(spi->irq, NULL, ad7877_irq,
                    IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
                    spi->dev.driver->name, ts);

And inside of ad7877_irq make a block call:

static irqreturn_t ad7877_irq(int irq, void *handle)
{
..
error = spi_sync(ts->spi, &ts->msg);
..
}

Is this ok?
With the new interface 'request_threaded_irq' all the IRQ are 
implemented on a thread?
Do i need to create a handler for thread and pass it to 
'request_threaded_irq', and if yes, why a lot of drivers, only pass 
quick_check_handler and make hard processing on it?

Excuse my poor English.

Regards.

             reply	other threads:[~2012-12-17 15:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17 15:11 Marcos Lois Bermúdez [this message]
2012-12-17 15:37 ` Question about using new request_threaded_irq Jonathan Corbet
2012-12-17 16:06   ` Marcos Lois Bermúdez
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=50CF361A.1030203@gmail.com \
    --to=marcos.discalis@gmail.com \
    --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