linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Stephen Warren <swarren@wwwdotorg.org>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	Alexandre Courbot <acourbot@nvidia.com>,
	Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
	Enric Balletbo i Serra <eballetbo@gmail.com>,
	Grant Likely <grant.likely@linaro.org>,
	Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>
Subject: Re: [PATCH] RFC: gpio: add API to be strict about GPIO IRQ usage
Date: Mon, 14 Oct 2013 10:03:57 +0200	[thread overview]
Message-ID: <CACRpkdbxFwK8j+FbsXTJaiEFU+uaNJSDKAmADAbcxGKJDAHSWw@mail.gmail.com> (raw)
In-Reply-To: <52584D3E.7030809@wwwdotorg.org>

On Fri, Oct 11, 2013 at 9:10 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 10/11/2013 02:39 AM, Linus Walleij wrote:

>> However that is not the whole story, is it? We have a gazillion
>> drivers calling irq_create_mapping() in this function, so I would
>> say that things are already a mess here.
>
> I expect things are a mess indeed:-)
>
> I believe that if a driver is only calling irq_create_mapping() inside
> gpio_to_irq(), it's a bug. I think things can operate correctly in one
> of two cases, at least with DT:
>
> 1) irq_create_mapping() is called from both gpio_to_irq() and the
> of_xlate callback for IRQs.
>
> (I don't think this method would work in a board-file-based system where
> of_xlate isn't called for IRQs...)
>
> or:
>
> 2) irq_create_mapping() is called for all IRQs when registering the IRQ
> controller/domain.
>
> To me, (2) is much simpler, and avoids the issue (1) probably has with
> only supporting direct IRQ usage (without something calling gpio_to_irq()).

Hm. Jean-Christophe says (1) is the way to go ... This is
arch/arm/mach-at91/gpio.c I guess.

But this seems to call irq_create_mapping() for all IRQs on
all gpiochips in at91_gpio_irq_setup() which is called by the board
init code?

Maybe I'm not following this :-/

I'll take a look over "my" GPIO drivers and see how I can make
those a bit more elegant so as to set a good example.

Yours,
Linus Walleij

  parent reply	other threads:[~2013-10-14  8:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-24 11:33 [PATCH] RFC: gpio: add API to be strict about GPIO IRQ usage Linus Walleij
2013-09-24 15:42 ` Javier Martinez Canillas
2013-09-24 17:51 ` Stephen Warren
2013-10-11  8:39   ` Linus Walleij
2013-10-11 19:10     ` Stephen Warren
2013-10-12  6:06       ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-14 18:00         ` Stephen Warren
2013-10-14 19:47           ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-14  8:03       ` Linus Walleij [this message]
2013-10-14 10:23         ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-11  9:31 ` Jean-Christophe PLAGNIOL-VILLARD

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=CACRpkdbxFwK8j+FbsXTJaiEFU+uaNJSDKAmADAbcxGKJDAHSWw@mail.gmail.com \
    --to=linus.walleij@linaro.org \
    --cc=acourbot@nvidia.com \
    --cc=eballetbo@gmail.com \
    --cc=grant.likely@linaro.org \
    --cc=javier.martinez@collabora.co.uk \
    --cc=linux-gpio@vger.kernel.org \
    --cc=plagnioj@jcrosoft.com \
    --cc=santosh.shilimkar@ti.com \
    --cc=swarren@wwwdotorg.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).