Messages in this thread |  | | From | David Brownell <> | | Subject | Re: [PATCH v2] GPIO: Add gpio_lookup | | Date | Tue, 13 Oct 2009 15:53:58 -0700 |
| |
On Tuesday 13 October 2009, Jonathan Corbet wrote: > On Tue, 13 Oct 2009 14:10:40 -0700 > David Brownell <david-b@pacbell.net> 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 > >
|  |