All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 1/4] [POWERPC] Implement GPIO API embryo
Date: Sun, 23 Dec 2007 14:40:46 +1100	[thread overview]
Message-ID: <20071223034046.GC10699@localhost.localdomain> (raw)
In-Reply-To: <b632798b4f5523653160b6a7156266e1@kernel.crashing.org>

On Sun, Dec 23, 2007 at 03:49:30AM +0100, Segher Boessenkool wrote:
> > +int __of_parse_gpio_bank_pin(struct device_node *np, int index,
> > +			     int bank_width, int max_bank)
> > +{
> > +	int bank;
> > +	int pin;
> > +	const u32 *gpios;
> > +
> > +	/*
> > +	 * We can get there only if of_get_gpio() succeeded, thus
> > +	 * no need checking for "gpios" existence.
> > +	 */
> > +	gpios = of_get_property(np, "gpios", NULL);
> > +	bank = gpios[index * 2];
> > +	pin = gpios[index * 2 + 1];
> 
> If you stick with the #gpio-cells plan, here is where you should use it.

I think part of what's happening here is due to the patch's history.
The "bank pin" information was always of a format local to the
controller, but originally the size wasn't explicitly stated in the
tree - it was just implicit in the type of gpio controller.  I
suggested that #gpio-cells be added, which it has been, but it looks
like the code hasn't been updated to use it everywhere.  Obviously a
driver for a particular gpio controller would generally need to assert
that the controller's #gpio-cells has the correct value for this
controller type, after which code like the above would be acceptable.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

  reply	other threads:[~2007-12-23  3:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-21 20:28 [PATCH 0/4] PowerPC: implement GPIO API Anton Vorontsov
2007-12-21 20:31 ` [PATCH 1/4] [POWERPC] Implement GPIO API embryo Anton Vorontsov
2007-12-23  2:49   ` Segher Boessenkool
2007-12-23  3:40     ` David Gibson [this message]
2007-12-23 10:00       ` Segher Boessenkool
2007-12-21 20:31 ` [PATCH 2/4] [POWERPC] QE: implement GPIO API Anton Vorontsov
2007-12-21 20:31 ` [PATCH 3/4] [POWERPC] CPM2: " Anton Vorontsov
2007-12-21 21:16   ` Arnd Bergmann
2007-12-21 23:58     ` Anton Vorontsov
2007-12-21 20:34 ` [PATCH 4/4] [POWERPC] CPM1: " Anton Vorontsov
2007-12-22  9:54   ` Jochen Friedrich
2007-12-22 16:08     ` Jochen Friedrich
2007-12-22 18:38       ` Anton Vorontsov
2007-12-21 20:50 ` [PATCH 0/4] PowerPC: " Grant Likely
2007-12-21 21:04   ` Anton Vorontsov
2007-12-21 21:17     ` Grant Likely
2007-12-22  0:16       ` Anton Vorontsov
2007-12-23  2:47 ` Segher Boessenkool
2007-12-23  3:37   ` David Gibson
2007-12-23  9:53     ` Segher Boessenkool
2007-12-23 11:47       ` Anton Vorontsov

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=20071223034046.GC10699@localhost.localdomain \
    --to=david@gibson.dropbear.id.au \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=segher@kernel.crashing.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.