Re: [RFC] gpiolib: introduce descriptor-based GPIO interface

From: Linus Walleij
Date: Thu Dec 06 2012 - 15:19:36 EST

On Thu, Dec 6, 2012 at 8:45 AM, Alexandre Courbot <acourbot@xxxxxxxxxx> wrote:

> With the current API, GPIOs are manipulated through an integer which
> represents their unique number across the system. This poses problems in
> terms of portability, scalability and flexibility: for instance, the
> number of valid GPIOs for a given system is fixed at system time, and a
> large array of that size is statically allocated to hold the GPIO
> descriptors. Worse, GPIOs can be used without being properly allocated.
> In order to improve the situation, the integer namespace must first get
> away. This patch introduces an alternative GPIO API that uses opaque
> handlers and refactor gpiolib's internals to work with these handlers
> instead of GPIO numbers. The former integer-based API is still available
> as a light wrapper around this new API.
> This first step will then us to build more improvements for gpiolib,
> like proper GPIO lookup functions per device and provider, and getting
> rid of the static GPIO array and the ARCH_NR_GPIO configuration option.
> Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>

I really like this. It is looking very good.

Especially it's nice that it makes GPIO descriptors the norm
rather than a bolt-on, and the old linear GPIO space is turned
into a comaptibility layer using static inlines.

I'd like to see some love for Documentation/gpio.txt to reflect
the changes, plus considering Grants note, and I will be happy
to add Reviewed-by on this.

Especially the lookups will be nice to see going forward!

Linus Walleij
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at