diff mbox series

[2/4] gpio/rockchip: fix get_direction value handling

Message ID 20210913224926.1260726-3-heiko@sntech.de
State Accepted
Commit b22a4705e2e60f342b1b851c9ebdb3ea02f21f8f
Headers show
Series None | expand

Commit Message

Heiko Stübner Sept. 13, 2021, 10:49 p.m. UTC
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>
---
 drivers/gpio/gpio-rockchip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij Sept. 17, 2021, 11:30 p.m. UTC | #1
On Tue, Sep 14, 2021 at 12:49 AM Heiko Stuebner <heiko@sntech.de> wrote:

> 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>


Yours,
Linus Walleij
Bartosz Golaszewski Sept. 22, 2021, 9:46 a.m. UTC | #2
On Tue, Sep 14, 2021 at 12:49 AM Heiko Stuebner <heiko@sntech.de> wrote:
>

> 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>

> ---


Queued for fixes. Thanks!

Bart
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index 16d9bf7188e3..3335bd57761d 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -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;