[PATCH] pio: add arch specific gpio_is_valid() function
Ben Nizette
bn at niasdigital.com
Tue Sep 7 04:41:38 EDT 2010
On 07/09/2010, at 4:33 PM, David Brownell wrote:
>
>
> --- On Mon, 9/6/10, Ryan Mallon <ryan at bluewatersys.com> 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 :-)
---8K---
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
numbers.
Fix the documentation to clarify these points.
[1] http://lkml.org/lkml/2010/8/23/187
Signed-off-by: Ben Nizette <bn at niasdigital.com>
---
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
More information about the linux-arm-kernel
mailing list