From: Jürg Billeter Date: Tue, 24 Jun 2014 02:19:50 +0000 (+0200) Subject: gpio: rcar: clamp returned value to [0,1] X-Git-Tag: upstream/snapshot3+hdmi~310 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ef57f7911ece40e35e0fa42a178307ddc1909e4f;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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 Signed-off-by: Linus Walleij (cherry picked from commit 7cb5409b10d9f8316ca2539591acb6a5f7fd4139) Signed-off-by: Simon Horman --- diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index b6ae89e..0d251dc 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) /* testing on r8a7790 shows that INDT does not show correct pin state * when configured as output, so use OUTDT in case of output pins */ if (gpio_rcar_read(gpio_to_priv(chip), INOUTSEL) & bit) - return (int)(gpio_rcar_read(gpio_to_priv(chip), OUTDT) & bit); + return !!(gpio_rcar_read(gpio_to_priv(chip), OUTDT) & bit); else - return (int)(gpio_rcar_read(gpio_to_priv(chip), INDT) & bit); + return !!(gpio_rcar_read(gpio_to_priv(chip), INDT) & bit); } static void gpio_rcar_set(struct gpio_chip *chip, unsigned offset, int value)