linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
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

  reply	other threads:[~2011-12-05 13:35 UTC|newest]

Thread overview: 15+ 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 ` [PATCH 2/2] gpio/tegra: Dynamically allocate IRQ base, and support DT Stephen Warren
2011-12-01 13:42   ` Rob Herring
2011-12-01 14:11     ` Jamie Iles
2011-12-01 16:52       ` Stephen Warren
2011-12-01 16:55         ` Jamie Iles
2011-12-01 20:57           ` Stephen Warren
2011-12-01 22:05             ` Nicolas Ferre
2011-12-08 14:15               ` Shawn Guo
2011-12-05  6:55   ` Shawn Guo
2011-12-05 13:35     ` Rob Herring [this message]
2011-12-05 14:44       ` Shawn Guo
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@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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).