gpio: rcar: clamp returned value to [0,1]
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- drivers/gpio/gpio-rcar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-rcar.c +2 -2
@@ -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)
Signature · 1 line
2.0.0
Quoted 4 lines · Jürg Billeter
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 <[email protected]>
Patch obviously correct to applied.
Yours,
Linus Walleij