X-Git-Url: http://git.cascardo.info/?a=blobdiff_plain;ds=sidebyside;f=include%2Fasm-generic%2Fgpio.h;h=8ca18e26d7e39fe429a8179d48f2f9f17f58a589;hb=00e8976200665eec2fa9264d61885b4d1384d4f0;hp=c7376bf80b0604bf8f8b9394989178d6de45ecc2;hpb=d1126ad907ce197ff45fbc2369fbeaf8ae6f75a8;p=cascardo%2Flinux.git diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index c7376bf80b06..8ca18e26d7e3 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -16,15 +16,27 @@ * While the GPIO programming interface defines valid GPIO numbers * to be in the range 0..MAX_INT, this library restricts them to the * smaller range 0..ARCH_NR_GPIOS-1. + * + * ARCH_NR_GPIOS is somewhat arbitrary; it usually reflects the sum of + * builtin/SoC GPIOs plus a number of GPIOs on expanders; the latter is + * actually an estimate of a board-specific value. */ #ifndef ARCH_NR_GPIOS #define ARCH_NR_GPIOS 256 #endif +/* + * "valid" GPIO numbers are nonnegative and may be passed to + * setup routines like gpio_request(). only some valid numbers + * can successfully be requested and used. + * + * Invalid GPIO numbers are useful for indicating no-such-GPIO in + * platform data and other tables. + */ + static inline int gpio_is_valid(int number) { - /* only some non-negative numbers are valid */ return ((unsigned)number) < ARCH_NR_GPIOS; }