linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Javier Martinez Canillas <javier@dowhile0.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	Santosh Shilimkar <ssantosh@kernel.org>,
	Tony Lindgren <tony@atomide.com>,
	ext Kevin Hilman <khilman@deeprootsystems.com>,
	Alexandre Courbot <gnurou@gmail.com>,
	Linux-OMAP <linux-omap@vger.kernel.org>,
	'Thomas Gleixner' <tglx@linutronix.de>
Subject: Re: [PATCH] gpio: omap: use raw locks for locking
Date: Mon, 27 Jul 2015 15:25:59 +0200	[thread overview]
Message-ID: <55B63167.9000107@linutronix.de> (raw)
In-Reply-To: <CACRpkdaHiJ5qYGu=t7hDTvvUuf4h-Q2_5Xv4GzvSPS1SZ6F_Gw@mail.gmail.com>

On 07/27/2015 02:50 PM, Linus Walleij wrote:
> Patch applied.
thanks.

> 
> Now this question appear in my head:
> 
> Is drivers/gpio full of stuff that will not work with the -RT kernel,
> and is this a change that should be done mutatis mutandis on
> all the GPIO drivers?

I described two call paths where you need a rawlock_t. If your gpio
driver uses irq_chip_generic then you a rawlock here and things should
be fine.

In general: If your gpio controller acts as an interrupts controller
(that is via chained handler) then you need the raw-locks if you need
any locking (if you have a write 1 to mask/unmask/enable/disable
register then you probably don't need any locking here at all). If the
gpio controller does not act as an interrupt controller than the
spinlock_t type should be enough.
If your gpio-interrupt controller requests its interrupt via
requested_threaded_irq() then it should do handle_nested_irq() and a
mutex is probably used for locking.

Using request_irq() with "0" flags is kind of broken. It works in
IRQ-context and delivers the interrupts with generic_handle_irq() and
this one passes it the handler (like handle_edge_irq() /
handle_level_irq()) which takes a raw_lock. Now, if you boot the
vanilla kernel with threadedirq then the irq-handler runs in threaded
context and you can't take a spinlock here anymore. So I think you
should use here IRQF_NO_THREAD here (and the raw lock type). I added
tglx on Cc: to back up because it is Monday.

> Yours,
> Linus Walleij
> 

Sebastian

  reply	other threads:[~2015-07-27 13:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-21 16:26 [PATCH] gpio: omap: use raw locks for locking Sebastian Andrzej Siewior
2015-07-27 12:50 ` Linus Walleij
2015-07-27 13:25   ` Sebastian Andrzej Siewior [this message]
2015-07-28 12:22     ` Thomas Gleixner
  -- strict thread matches above, loose matches on Subject: below --
2015-02-12 16:10 Sebastian Andrzej Siewior
2015-02-16  8:54 ` Javier Martinez Canillas
2015-02-25  9:44   ` Sebastian Andrzej Siewior
2015-06-19 21:52 ` Javier Martinez Canillas
2015-06-30  6:45 ` Linus Walleij
2015-06-30 16:39   ` Sebastian Andrzej Siewior

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=55B63167.9000107@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=gnurou@gmail.com \
    --cc=javier@dowhile0.org \
    --cc=khilman@deeprootsystems.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=ssantosh@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tony@atomide.com \
    /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).