All of lore.kernel.org
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: Thierry Reding
	<thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>,
	Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
	Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"
	<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>
Subject: Re: [PATCH 5/6] gpio: tegra: Dynamically allocate IRQ base, and support DT
Date: Thu, 5 Jan 2012 10:56:03 -0700	[thread overview]
Message-ID: <20120105175603.GA22653@ponder.secretlab.ca> (raw)
In-Reply-To: <74CDBE0F657A3D45AFBB94109FB122FF17761F16C2-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>

On Thu, Jan 05, 2012 at 09:47:44AM -0800, Stephen Warren wrote:
> Thierry Reding wrote at Thursday, January 05, 2012 12:23 AM:
> > * Stephen Warren wrote:
> > > @@ -343,6 +344,16 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev)
> > >  	int i;
> > >  	int j;
> > >
> > > +	irq_domain.irq_base = irq_alloc_descs(-1, 0, TEGRA_NR_GPIOS, 0);
> > > +	if (irq_domain.irq_base < 0) {
> > > +		dev_err(&pdev->dev, "Couldn't allocate IRQ numbers\n");
> > > +		return -ENODEV;
> > > +	}
> > > +	irq_domain.nr_irq = TEGRA_NR_GPIOS;
> > > +	irq_domain.ops = &irq_domain_simple_ops;
> > > +	irq_domain.of_node = pdev->dev.of_node;
> > > +	irq_domain_add(&irq_domain);
> > 
> > I was wondering: except for setting the nr_irq field this is pretty much what
> > irq_domain_add_simple() does. While I get that you need access to the domain
> > later on and cannot use the helper, I'm still wondering why the nr_irq field
> > is not initialized by irq_domain_add_simple().
> 
> I'm not completely sure, but I think irq_domain_add_simple() was initially
> added as a transition measure; it looks like all the current users are for
> a single top-level interrupt controller where the Linux IRQ numbers are
> used directly in the .dts files. Once you add other interrupt controllers
> into the mix, the API as-is starts to make less sense.
> 
> > I have a driver for a GPIO/IRQ expander that does exactly the same and was
> > always wondering why the irq_data.hwirq field isn't properly setup, and
> > irq_domain.nr_irq being 0 seems to be exactly the reason. So am I supposed to
> > not use irq_domain_add_simple() in this case or should we rather update the
> > helper to take a nr_irq parameter that can be used to initialize the nr_irq
> > field?
> 
> I think updating the helper like that makes sense, and also have it return
> the IRQ domain object. Grant, do you agree?

Update the helper.

g.

WARNING: multiple messages have this Message-ID (diff)
From: grant.likely@secretlab.ca (Grant Likely)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/6] gpio: tegra: Dynamically allocate IRQ base, and support DT
Date: Thu, 5 Jan 2012 10:56:03 -0700	[thread overview]
Message-ID: <20120105175603.GA22653@ponder.secretlab.ca> (raw)
In-Reply-To: <74CDBE0F657A3D45AFBB94109FB122FF17761F16C2@HQMAIL01.nvidia.com>

On Thu, Jan 05, 2012 at 09:47:44AM -0800, Stephen Warren wrote:
> Thierry Reding wrote at Thursday, January 05, 2012 12:23 AM:
> > * Stephen Warren wrote:
> > > @@ -343,6 +344,16 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev)
> > >  	int i;
> > >  	int j;
> > >
> > > +	irq_domain.irq_base = irq_alloc_descs(-1, 0, TEGRA_NR_GPIOS, 0);
> > > +	if (irq_domain.irq_base < 0) {
> > > +		dev_err(&pdev->dev, "Couldn't allocate IRQ numbers\n");
> > > +		return -ENODEV;
> > > +	}
> > > +	irq_domain.nr_irq = TEGRA_NR_GPIOS;
> > > +	irq_domain.ops = &irq_domain_simple_ops;
> > > +	irq_domain.of_node = pdev->dev.of_node;
> > > +	irq_domain_add(&irq_domain);
> > 
> > I was wondering: except for setting the nr_irq field this is pretty much what
> > irq_domain_add_simple() does. While I get that you need access to the domain
> > later on and cannot use the helper, I'm still wondering why the nr_irq field
> > is not initialized by irq_domain_add_simple().
> 
> I'm not completely sure, but I think irq_domain_add_simple() was initially
> added as a transition measure; it looks like all the current users are for
> a single top-level interrupt controller where the Linux IRQ numbers are
> used directly in the .dts files. Once you add other interrupt controllers
> into the mix, the API as-is starts to make less sense.
> 
> > I have a driver for a GPIO/IRQ expander that does exactly the same and was
> > always wondering why the irq_data.hwirq field isn't properly setup, and
> > irq_domain.nr_irq being 0 seems to be exactly the reason. So am I supposed to
> > not use irq_domain_add_simple() in this case or should we rather update the
> > helper to take a nr_irq parameter that can be used to initialize the nr_irq
> > field?
> 
> I think updating the helper like that makes sense, and also have it return
> the IRQ domain object. Grant, do you agree?

Update the helper.

g.

  parent reply	other threads:[~2012-01-05 17:56 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-04 18:39 [PATCH 1/6] ARM: tegra: Remove use of TEGRA_GPIO_TO_IRQ Stephen Warren
2012-01-04 18:39 ` Stephen Warren
     [not found] ` <1325702378-20863-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-01-04 18:39   ` [PATCH 2/6] dt: tegra gpio: Flesh out binding documentation Stephen Warren
2012-01-04 18:39     ` Stephen Warren
2012-01-04 18:39   ` [PATCH 3/6] ARM: dt: tegra30.dtsi: Reformat gpio's interrupts property Stephen Warren
2012-01-04 18:39     ` Stephen Warren
     [not found]     ` <1325702378-20863-3-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-01-04 19:50       ` Grant Likely
2012-01-04 19:50         ` Grant Likely
2012-01-04 18:39   ` [PATCH 4/6] ARM: dt: tegra30.dtsi: Add extra GPIO interrupt Stephen Warren
2012-01-04 18:39     ` Stephen Warren
2012-01-04 18:39   ` [PATCH 5/6] gpio: tegra: Dynamically allocate IRQ base, and support DT Stephen Warren
2012-01-04 18:39     ` Stephen Warren
     [not found]     ` <1325702378-20863-5-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-01-05  7:23       ` Thierry Reding
2012-01-05  7:23         ` Thierry Reding
     [not found]         ` <20120105072306.GA3980-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-01-05 17:47           ` Stephen Warren
2012-01-05 17:47             ` Stephen Warren
     [not found]             ` <74CDBE0F657A3D45AFBB94109FB122FF17761F16C2-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2012-01-05 17:56               ` Grant Likely [this message]
2012-01-05 17:56                 ` Grant Likely
2012-01-05 13:17       ` Jamie Iles
2012-01-05 13:17         ` Jamie Iles
2012-01-05 16:47         ` Stephen Warren
2012-01-05 16:47           ` Stephen Warren
     [not found]           ` <74CDBE0F657A3D45AFBB94109FB122FF17761F1683-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2012-01-05 16:48             ` Jamie Iles
2012-01-05 16:48               ` Jamie Iles
2012-01-04 18:39   ` [PATCH 6/6] gpio: tegra: Parameterize the number of banks Stephen Warren
2012-01-04 18:39     ` Stephen Warren
     [not found]     ` <1325702378-20863-6-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-01-04 19:54       ` Rob Herring
2012-01-04 19:54         ` Rob Herring
     [not found]         ` <4F04AE71.2090203-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-01-04 20:00           ` Stephen Warren
2012-01-04 20:00             ` Stephen Warren
     [not found]             ` <74CDBE0F657A3D45AFBB94109FB122FF17761F145E-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2012-01-04 22:00               ` Grant Likely
2012-01-04 22:00                 ` Grant Likely
     [not found]                 ` <CACxGe6tyZKW37sGiDauvikU70ZVLHFVrXjBPJk2Kgee1Rj3sbg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-05 17:24                   ` Rob Herring
2012-01-05 17:24                     ` Rob Herring
     [not found]                     ` <4F05DCDB.40806-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-01-13 20:55                       ` Stephen Warren
2012-01-13 20:55                         ` Stephen Warren
     [not found]                         ` <74CDBE0F657A3D45AFBB94109FB122FF17801D2039-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2012-01-14 15:15                           ` Rob Herring
2012-01-14 15:15                             ` Rob Herring
2012-01-04 19:52   ` [PATCH 1/6] ARM: tegra: Remove use of TEGRA_GPIO_TO_IRQ Grant Likely
2012-01-04 19:52     ` Grant Likely
     [not found]     ` <20120104195218.GF15503-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2012-01-24  8:34       ` Olof Johansson
2012-01-24  8:34         ` Olof Johansson

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=20120105175603.GA22653@ponder.secretlab.ca \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@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=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
    --cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@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.