diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2013-02-27 10:25:15 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2013-03-02 08:20:21 -0500 |
commit | e97f9b5277afeabb54892ebc6f68500098467ba1 (patch) | |
tree | 598ee12c94ce73155d8046cfe16210dc09c40014 /drivers/gpio | |
parent | 24d7628fe8b10bb3770a11ddf71719613832a298 (diff) |
gpio/gpio-ich: fix ichx_gpio_check_available() return what callers expect
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>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-ich.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-ich.c b/drivers/gpio/gpio-ich.c index 6f2306db8591..f9dbd503fc40 100644 --- a/drivers/gpio/gpio-ich.c +++ b/drivers/gpio/gpio-ich.c | |||
@@ -128,9 +128,9 @@ static int ichx_read_bit(int reg, unsigned nr) | |||
128 | return data & (1 << bit) ? 1 : 0; | 128 | return data & (1 << bit) ? 1 : 0; |
129 | } | 129 | } |
130 | 130 | ||
131 | static int ichx_gpio_check_available(struct gpio_chip *gpio, unsigned nr) | 131 | static bool ichx_gpio_check_available(struct gpio_chip *gpio, unsigned nr) |
132 | { | 132 | { |
133 | return (ichx_priv.use_gpio & (1 << (nr / 32))) ? 0 : -ENXIO; | 133 | return ichx_priv.use_gpio & (1 << (nr / 32)); |
134 | } | 134 | } |
135 | 135 | ||
136 | static int ichx_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) | 136 | static int ichx_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) |