diff options
author | Guennadi Liakhovetski <g.liakhovetski@pengutronix.de> | 2008-04-28 02:14:46 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 08:58:34 -0700 |
commit | e6de1808f8ebfeb7e49f3c5a30cb8f2032beb287 (patch) | |
tree | 2230ea8f384449c7785d636ab016af3b2aa20123 /Documentation/gpio.txt | |
parent | d72cbed0c486e3db8b56380635f8e845073ce63a (diff) |
gpio: define gpio_is_valid()
Introduce a gpio_is_valid() predicate; use it in gpiolib.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
[ use inline function; follow the gpio_* naming convention;
work without gpiolib; all programming interfaces need docs ]
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/gpio.txt')
-rw-r--r-- | Documentation/gpio.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt index 54630095aa3..c35ca9e40d4 100644 --- a/Documentation/gpio.txt +++ b/Documentation/gpio.txt @@ -107,6 +107,16 @@ type of GPIO controller, and on one particular board 80-95 with an FPGA. The numbers need not be contiguous; either of those platforms could also use numbers 2000-2063 to identify GPIOs in a bank of I2C GPIO expanders. +If you want to initialize a structure with an invalid GPIO number, use +some negative number (perhaps "-EINVAL"); that will never be valid. To +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. + Whether a platform supports multiple GPIO controllers is currently a platform-specific implementation issue. |