Re: [PATCH v2] GPIO: Add gpio_lookup

From: David Brownell
Date: Tue Oct 13 2009 - 18:22:01 EST


On Tuesday 13 October 2009, Ben Nizette wrote:
> If gpios are going to be named, and it seems they are,

I'm not so sure of that. Keep in mind that "name" implies, to me,
focussing on name-centric operation, with lookup and browsing.
Neither of those mechanisms is fundamental to what GPIOs solve.

So far I've not seen any use case that can't be addressed within
the current framework, which keys only on numeric IDs. If we *did*
see such cases appear in real-world scenarios, we could explore
what that means.


> then personally
> I'd like to see the names field of struct gpio_chip go and a proper
> namespace layer inserted.  Something which allows gpio_name() and
> gpio_lookup() and decentralises that responsibility would be nice (the
> chip could call gpio_name itself if it has reason).  That code could be
> common to all gpio framework implementations.

But why would we need such lookups in the first place?

In-kernel, they are not needed, for either static or dynamic ID
assignment schemes. Just register the numbers so they're available
as needed.

For userspace, I think gpio_export_link() is the best way to
go ... it scopes the names sanely, so there's no requirement
for driver-provided labels to be globally unique.

- Dave

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/