[lkml]   [2010]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: [PATCH] pio: add arch specific gpio_is_valid() function

On 07/09/2010, at 4:33 PM, David Brownell wrote:

> --- On Mon, 9/6/10, Ryan Mallon <> wrote:
>> How about this approach instead?
> Still don't like it, sorry. gpio_is_valid()
> is not intended as a fine-grained call, there is
> a call which is fine grained; use that instead.

I've been sitting on the sidelines but it seems like the below might
help :-)


A recent discussion on LKML [1] highlighted some confusion regarding the
semantics of the gpio validity checks versus the gpio request mechanism.

gpio_is_valid determines whether a gpio /can/ be attached to a
controller, gpio_request determines whether that gpio currently /is/
attached to a controller. Part of the confusion seems to come at least
in part from the overlooking of facility for dynamically added gpio

Fix the documentation to clarify these points.


Signed-off-by: Ben Nizette <>
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt
index d96a6db..adc0db2 100644
--- a/Documentation/gpio.txt
+++ b/Documentation/gpio.txt
@@ -113,12 +113,13 @@ test if a number could reference a GPIO, you may use this predicate:

int gpio_is_valid(int number);

-A number that's not valid will be rejected by calls which may request
-or free GPIOs (see below). Other numbers may also be rejected; for
-example, a number might be valid but unused on a given board.
+This will return true for any number which may represent a valid gpio
+regardless of whether or not that identifier is currently active. To
+determine whether an identifier is linked to a controller and therefore
+able to be used the request/free mechanism should be used (see below).

-Whether a platform supports multiple GPIO controllers is currently a
-platform-specific implementation issue.
+Whether a platform supports multiple and/or dynamically added GPIO
+controllers is currently a platform-specific implementation issue.

Using GPIOs

 \ /
  Last update: 2010-09-07 10:45    [W:0.074 / U:9.884 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site