gpio/rockchip: fix get_direction value handling
authorHeiko Stuebner <heiko@sntech.de>
Mon, 13 Sep 2021 22:49:24 +0000 (00:49 +0200)
committerBartosz Golaszewski <brgl@bgdev.pl>
Wed, 22 Sep 2021 09:31:52 +0000 (11:31 +0200)
The function uses the newly introduced rockchip_gpio_readl_bit()
which directly returns the actual value of the requeste bit.
So using the existing bit-wise check for the bit inside the value
will always return 0.

Fix this by dropping the bit manipulation on the result.

Fixes: 3bcbd1a85b68 ("gpio/rockchip: support next version gpio controller")
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
drivers/gpio/gpio-rockchip.c

index 16d9bf7..3335bd5 100644 (file)
@@ -141,7 +141,7 @@ static int rockchip_gpio_get_direction(struct gpio_chip *chip,
        u32 data;
 
        data = rockchip_gpio_readl_bit(bank, offset, bank->gpio_regs->port_ddr);
-       if (data & BIT(offset))
+       if (data)
                return GPIO_LINE_DIRECTION_OUT;
 
        return GPIO_LINE_DIRECTION_IN;