[lkml]   [2009]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v2] GPIO: Add gpio_lookup
On Tuesday 13 October 2009, Jonathan Corbet wrote:
> On Tue, 13 Oct 2009 14:10:40 -0700
> David Brownell <> wrote:
> > Not real keen on this; see separate emails, and below.
> OK, so the story I'm getting is that each driver needs to set up its
> own mechanism for obtaining GPIO numbers - it needs to create its own
> lookup mechanism.

Each driver needs its own *configuration* scheme. Yes;
that's a very standard requirement. ;)

> That's fine, I can do that; I just thought it made
> sense to make use of the information that's already there.

It's not necessarily "there" though; or safe to use in this way,
should it happen to be present.

> Andrew, you might as well drop the patch.
> (I'm less worried about the uniqueness side, BTW; it just means drivers
> need to create meaningful names for their GPIOs.)

I don't see how they *can* though ... unless they're dynamically
allocated using a scheme like "combine <this device's sysfs name>
with <token>". Consider two PCI cards with two different GPIOs
for their "camera_active" LED... "camera_active" is meaningful,
but unusable because it's not unique.

Quick rule of thumb: in absolutely *ANYTHING* to do with resource
lookup, see how the names/IDs are scoped. That's the first place
problems show up. If the scopes are not clearly defined, or there
is nothing to ensure uniqueness within that scope ... trouble.

- Dave

> Thanks,
> jon

 \ /
  Last update: 2009-10-14 01:03    [W:0.048 / U:1.864 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site