]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/gpio/omap_gpio.c
ARM: OMAP: GPIO: Fix valid range and enable usage of all GPIOs on OMAP5
[karo-tx-uboot.git] / drivers / gpio / omap_gpio.c
index fc89f2a42b12b0c8690a80e52d5842b5902e9e0a..f16e9ae4d2b3765533fd937e813cc60488fae528 100644 (file)
@@ -53,18 +53,14 @@ static inline int get_gpio_index(int gpio)
        return gpio & 0x1f;
 }
 
-static inline int gpio_valid(int gpio)
+int gpio_is_valid(int gpio)
 {
-       if (gpio < 0)
-               return -1;
-       if (gpio < 192)
-               return 0;
-       return -1;
+       return (gpio >= 0) && (gpio < OMAP_MAX_GPIO);
 }
 
 static int check_gpio(int gpio)
 {
-       if (gpio_valid(gpio) < 0) {
+       if (!gpio_is_valid(gpio)) {
                printf("ERROR : check_gpio: invalid GPIO %d\n", gpio);
                return -1;
        }