diff mbox series

gpio: gpio-amd-fch: Correct logic of GPIO_LINE_DIRECTION

Message ID 20200920203430.25829-1-lists@wildgooses.com
State Accepted
Commit d25e8fdebdad84219b498873300b7f11dd915b88
Headers show
Series gpio: gpio-amd-fch: Correct logic of GPIO_LINE_DIRECTION | expand

Commit Message

Ed W Sept. 20, 2020, 8:34 p.m. UTC
The original commit appears to have the logic reversed in
amd_fch_gpio_get_direction. Also confirmed by observing the value of
"direction" in the sys tree.

Signed-off-by: Ed Wildgoose <lists@wildgooses.com>
---
 drivers/gpio/gpio-amd-fch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bartosz Golaszewski Sept. 24, 2020, 1:29 p.m. UTC | #1
On Sun, Sep 20, 2020 at 10:34 PM Ed Wildgoose <lists@wildgooses.com> wrote:
>
> The original commit appears to have the logic reversed in
> amd_fch_gpio_get_direction. Also confirmed by observing the value of
> "direction" in the sys tree.
>
> Signed-off-by: Ed Wildgoose <lists@wildgooses.com>
> ---
>  drivers/gpio/gpio-amd-fch.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-amd-fch.c b/drivers/gpio/gpio-amd-fch.c
> index 4e44ba4d7..2a21354ed 100644
> --- a/drivers/gpio/gpio-amd-fch.c
> +++ b/drivers/gpio/gpio-amd-fch.c
> @@ -92,7 +92,7 @@ static int amd_fch_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
>         ret = (readl_relaxed(ptr) & AMD_FCH_GPIO_FLAG_DIRECTION);
>         spin_unlock_irqrestore(&priv->lock, flags);
>
> -       return ret ? GPIO_LINE_DIRECTION_IN : GPIO_LINE_DIRECTION_OUT;
> +       return ret ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN;
>  }
>
>  static void amd_fch_gpio_set(struct gpio_chip *gc,
> --
> 2.26.2
>

Can you add a Fixes tag with the original commit?

Bartosz
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-amd-fch.c b/drivers/gpio/gpio-amd-fch.c
index 4e44ba4d7..2a21354ed 100644
--- a/drivers/gpio/gpio-amd-fch.c
+++ b/drivers/gpio/gpio-amd-fch.c
@@ -92,7 +92,7 @@  static int amd_fch_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
 	ret = (readl_relaxed(ptr) & AMD_FCH_GPIO_FLAG_DIRECTION);
 	spin_unlock_irqrestore(&priv->lock, flags);
 
-	return ret ? GPIO_LINE_DIRECTION_IN : GPIO_LINE_DIRECTION_OUT;
+	return ret ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN;
 }
 
 static void amd_fch_gpio_set(struct gpio_chip *gc,