From: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Shawn Guo <shawn.guo-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: Peter De Schrijver
<pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 2/2] gpio/tegra: Dynamically allocate IRQ base, and support DT
Date: Mon, 05 Dec 2011 07:35:16 -0600 [thread overview]
Message-ID: <4EDCC894.7060200@gmail.com> (raw)
In-Reply-To: <20111205065527.GD2980-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
Shawn,
On 12/05/2011 12:55 AM, Shawn Guo wrote:
> On Wed, Nov 30, 2011 at 05:45:36PM -0700, Stephen Warren wrote:
> [...]
>> static void tegra_gpio_irq_ack(struct irq_data *d)
>> {
>> - int gpio = d->irq - INT_GPIO_BASE;
>> + int gpio = d->hwirq;
>>
> Though it's working right now, I'm not sure it's safe enough. This
> only works when d->hwirq_base is 0, which is true for now. But I doubt
> it will be always true. I guess hwirq_base was introduced there for
> some reason. When some day irqdomain starts using this field, the
> above code starts being broken. IMO, the way that generic-chip.c is
> using to calculate the number, d->irq - gc->irq_base, is much more
> safer.
It does work as the GIC hwirq_base is non-zero. It was introduced
exactly so that no conversion of hwirq is needed for functions like
this. hwirq_base is the starting point local to the controller
numbering. Say you have gpio controller with 16 lines, but only the
upper 8 lines have interrupt capability. Then you would set hwirq_base
to 8 and nr_irq to 8. Then hwirq will always be set to 8-15.
Rob
WARNING: multiple messages have this Message-ID (diff)
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] gpio/tegra: Dynamically allocate IRQ base, and support DT
Date: Mon, 05 Dec 2011 07:35:16 -0600 [thread overview]
Message-ID: <4EDCC894.7060200@gmail.com> (raw)
In-Reply-To: <20111205065527.GD2980@S2100-06.ap.freescale.net>
Shawn,
On 12/05/2011 12:55 AM, Shawn Guo wrote:
> On Wed, Nov 30, 2011 at 05:45:36PM -0700, Stephen Warren wrote:
> [...]
>> static void tegra_gpio_irq_ack(struct irq_data *d)
>> {
>> - int gpio = d->irq - INT_GPIO_BASE;
>> + int gpio = d->hwirq;
>>
> Though it's working right now, I'm not sure it's safe enough. This
> only works when d->hwirq_base is 0, which is true for now. But I doubt
> it will be always true. I guess hwirq_base was introduced there for
> some reason. When some day irqdomain starts using this field, the
> above code starts being broken. IMO, the way that generic-chip.c is
> using to calculate the number, d->irq - gc->irq_base, is much more
> safer.
It does work as the GIC hwirq_base is non-zero. It was introduced
exactly so that no conversion of hwirq is needed for functions like
this. hwirq_base is the starting point local to the controller
numbering. Say you have gpio controller with 16 lines, but only the
upper 8 lines have interrupt capability. Then you would set hwirq_base
to 8 and nr_irq to 8. Then hwirq will always be set to 8-15.
Rob
next prev parent reply other threads:[~2011-12-05 13:35 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-01 0:45 [PATCH 1/2] arm/tegra: Remove use of TEGRA_GPIO_TO_IRQ Stephen Warren
2011-12-01 0:45 ` Stephen Warren
[not found] ` <1322700336-26866-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-12-01 0:45 ` [PATCH 2/2] gpio/tegra: Dynamically allocate IRQ base, and support DT Stephen Warren
2011-12-01 0:45 ` Stephen Warren
[not found] ` <1322700336-26866-2-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-12-01 13:42 ` Rob Herring
2011-12-01 13:42 ` Rob Herring
[not found] ` <4ED78461.40006-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-12-01 14:11 ` Jamie Iles
2011-12-01 14:11 ` Jamie Iles
2011-12-01 16:52 ` Stephen Warren
2011-12-01 16:52 ` Stephen Warren
[not found] ` <74CDBE0F657A3D45AFBB94109FB122FF174FDB01DD-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-12-01 16:55 ` Jamie Iles
2011-12-01 16:55 ` Jamie Iles
2011-12-01 20:57 ` Stephen Warren
2011-12-01 20:57 ` Stephen Warren
[not found] ` <74CDBE0F657A3D45AFBB94109FB122FF174FDB02BF-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-12-01 22:05 ` Nicolas Ferre
2011-12-01 22:05 ` Nicolas Ferre
[not found] ` <4ED7FA1B.1080109-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2011-12-08 14:15 ` Shawn Guo
2011-12-08 14:15 ` Shawn Guo
2011-12-05 6:55 ` Shawn Guo
2011-12-05 6:55 ` Shawn Guo
[not found] ` <20111205065527.GD2980-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-12-05 13:35 ` Rob Herring [this message]
2011-12-05 13:35 ` Rob Herring
[not found] ` <4EDCC894.7060200-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-12-05 14:44 ` Shawn Guo
2011-12-05 14:44 ` Shawn Guo
2011-12-05 17:19 ` Stephen Warren
2011-12-05 17:19 ` Stephen Warren
-- strict thread matches above, loose matches on Subject: below --
2011-12-05 4:15 [PATCH 0/6] arm/imx: kill macro MXC_GPIO_IRQ_START Shawn Guo
2011-12-05 4:15 ` [PATCH 2/2] gpio/tegra: Dynamically allocate IRQ base, and support DT Shawn Guo
2011-12-05 4:29 ` Shawn Guo
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=4EDCC894.7060200@gmail.com \
--to=robherring2-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=shawn.guo-KZfg59tc24xl57MIdRCFDg@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.