From: Ben Nizette <bn@niasdigital.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: LKML <linux-kernel@vger.kernel.org>,
David Brownell <dbrownell@users.sourceforge.net>,
Andrew Morton <akpm@linux-foundation.org>,
dsilvers@simtec.co.uk
Subject: Re: [PATCH v2] GPIO: Add gpio_lookup
Date: Mon, 12 Oct 2009 17:11:44 +1100 [thread overview]
Message-ID: <1255327904.5347.79.camel@ben-desktop> (raw)
In-Reply-To: <20091010135343.775e535f@bike.lwn.net>
On Sat, 2009-10-10 at 13:53 -0600, Jonathan Corbet wrote:
> GPIO: add gpio_lookup()
>
> GPIOs have names associated with them, but drivers cannot use those names
> and must thus rely on hardwired GPIO numbers. That, in turn, makes dynamic
> assignment hard to use. This patch adds a little function gpio_lookup()
> which returns the GPIO number associated with a name.
>
OK for something supposedly basic, all this gpio stuff is getting messy.
The gpio framework was written to use gpio numbers as they were
recognised as being common to all possible implementations of the
framework. Now gpiolib, one implementation (ok I think currently the
only implementation) of that framework, has the ability to have names
associated with the gpios it handles so userspace can get a better idea
of which gpio are which. This is kind of OK (see below) because gpiolib
and gpio-sysfs are inextricably linked. With the addition of this
patch, drivers are going to start not depending on the gpio framework
but on an implementation of that framework - gpiolib. Or at least
require that all future implementations track this dual namespace.
I didn't notice Daniel's original patch fly by otherwise I would have
said something at the time, but storing the names at the chip level
seems an odd idea. Given that at that stage they were only for sysfs
id, why not just give them as an argument to gpio_export()?
Back to this patch though, the gpio names have to come from the platform
code via some platform_data for the gpio chip [1], the driver then looks
up that pre-defined name to find the gpio number. Why not just pass the
gpio number straight to the end device driver through platform_data and
bypass the middle-man?
At a higher level, there have been a number of pushes recently; for one
reason or another people really really seem to want the dual number/name
namespace inside the kernel. With this patch we're at the stage where
this is true and gpiolib has functionality outside the gpio framework
concepts. In order to keep drivers properly cross-platform we have some
options: We can keep adding concepts and required functionality to the
gpio framework interface, recognise that some drivers won't be quite as
cross-platform as they could/should be or simply note that it's now been
2.5 years since the gpio framework and gpiolib were merged and it's
still the only implementation; maybe it's time to ditch the distinction
and simply make gpiolib /the/ way you wire up gpios.
David's call really, thoughts?
--Ben.
[1] which is ugly for at least avr32, the only platform I know
intimately, but not my current point
next prev parent reply other threads:[~2009-10-12 6:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-10 19:48 [PATCH] GPIO: Add gpio_lookup Jonathan Corbet
2009-10-10 19:53 ` [PATCH v2] " Jonathan Corbet
2009-10-12 6:11 ` Ben Nizette [this message]
2009-10-12 15:23 ` Jonathan Corbet
2009-10-13 8:31 ` Ben Nizette
2009-10-13 22:13 ` David Brownell
2009-10-13 22:06 ` David Brownell
2009-10-13 22:05 ` David Brownell
2009-10-13 21:10 ` David Brownell
2009-10-13 22:28 ` Jonathan Corbet
2009-10-13 22:53 ` David Brownell
2009-10-14 12:53 ` Mark Brown
2009-10-13 18:05 ` [PATCH] " Andrew Morton
2009-10-13 18:19 ` Jonathan Corbet
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=1255327904.5347.79.camel@ben-desktop \
--to=bn@niasdigital.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=dbrownell@users.sourceforge.net \
--cc=dsilvers@simtec.co.uk \
--cc=linux-kernel@vger.kernel.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