diff options
author | Jürg Billeter <j@bitron.ch> | 2014-06-23 22:19:50 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-07-09 06:22:44 -0400 |
commit | 7cb5409b10d9f8316ca2539591acb6a5f7fd4139 (patch) | |
tree | c36d6195b4d9eac0d4b64f3adbd97d5a6d33520f /drivers/gpio | |
parent | b41acf8869eac0737327380d23068b2e3f10a12a (diff) |
gpio: rcar: clamp returned value to [0,1]
While it will be clamped to bool by gpiolib, let's make this sane
in the driver as well.
Signed-off-by: Jürg Billeter <j@bitron.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-rcar.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index 0c9f803fc1ac..7c621211e17b 100644 --- a/drivers/gpio/gpio-rcar.c +++ b/drivers/gpio/gpio-rcar.c | |||
@@ -240,9 +240,9 @@ static int gpio_rcar_get(struct gpio_chip *chip, unsigned offset) | |||
240 | /* testing on r8a7790 shows that INDT does not show correct pin state | 240 | /* testing on r8a7790 shows that INDT does not show correct pin state |
241 | * when configured as output, so use OUTDT in case of output pins */ | 241 | * when configured as output, so use OUTDT in case of output pins */ |
242 | if (gpio_rcar_read(gpio_to_priv(chip), INOUTSEL) & bit) | 242 | if (gpio_rcar_read(gpio_to_priv(chip), INOUTSEL) & bit) |
243 | return (int)(gpio_rcar_read(gpio_to_priv(chip), OUTDT) & bit); | 243 | return !!(gpio_rcar_read(gpio_to_priv(chip), OUTDT) & bit); |
244 | else | 244 | else |
245 | return (int)(gpio_rcar_read(gpio_to_priv(chip), INDT) & bit); | 245 | return !!(gpio_rcar_read(gpio_to_priv(chip), INDT) & bit); |
246 | } | 246 | } |
247 | 247 | ||
248 | static void gpio_rcar_set(struct gpio_chip *chip, unsigned offset, int value) | 248 | static void gpio_rcar_set(struct gpio_chip *chip, unsigned offset, int value) |