]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
gpio/gpio-ich: fix ichx_gpio_check_available() return what callers expect
authorMika Westerberg <mika.westerberg@linux.intel.com>
Wed, 27 Feb 2013 15:25:15 +0000 (17:25 +0200)
committerGrant Likely <grant.likely@secretlab.ca>
Sat, 2 Mar 2013 13:20:21 +0000 (13:20 +0000)
ichx_gpio_check_available() returns either 0 or -ENXIO depending on whether
the given GPIO is available or not. However, callers of this function treat
the return value as boolean:

...
if (!ichx_gpio_check_available(gpio, nr))
return -ENXIO;

which erroneusly fails when the GPIO is available and not vice versa.

Fix this by making the function return boolean as expected by the callers.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
drivers/gpio/gpio-ich.c

index 6f2306db85915eca2690895eda7e8f6b375091ab..f9dbd503fc40fb0f1bccd0fa8f0995816a06b538 100644 (file)
@@ -128,9 +128,9 @@ static int ichx_read_bit(int reg, unsigned nr)
        return data & (1 << bit) ? 1 : 0;
 }
 
-static int ichx_gpio_check_available(struct gpio_chip *gpio, unsigned nr)
+static bool ichx_gpio_check_available(struct gpio_chip *gpio, unsigned nr)
 {
-       return (ichx_priv.use_gpio & (1 << (nr / 32))) ? 0 : -ENXIO;
+       return ichx_priv.use_gpio & (1 << (nr / 32));
 }
 
 static int ichx_gpio_direction_input(struct gpio_chip *gpio, unsigned nr)