提交 7cb5409b 编写于 作者: J Jürg Billeter 提交者: Linus Walleij

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: NJürg Billeter <j@bitron.ch>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 b41acf88
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册