Skip to contentSkip to conversation

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

PATCH In review Ed Wildgoose 2 participants 4 messages Sep 20, 2020 – Sep 28, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: gpio-amd-fch: Correct logic of GPIO_LINE_DIRECTION

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.

---
 drivers/gpio/gpio-amd-fch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-amd-fch.c +1 -1
index 4e44ba4d7..2a21354ed 100644
@@ -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,
Signature · 1 line
2.26.2
#1 lore raw
Quoted 24 lines · Ed Wildgoose

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.

---
 drivers/gpio/gpio-amd-fch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-amd-fch.c +1 -2
index 4e44ba4d7..2a21354ed 100644
@@ -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,
--
Quoted 2 lines

2.26.2

Can you add a Fixes tag with the original commit?

Bartosz

#2 lore raw

PATCH 1/1 gpio: gpio-amd-fch: Correct logic of GPIO_LINE_DIRECTION

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.

Fixes e09d168f13f0 ("gpio: AMD G-Series PCH gpio driver")
---
 drivers/gpio/gpio-amd-fch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-amd-fch.c +1 -1
index 4e44ba4d7..2a21354ed 100644
@@ -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,
Signature · 1 line
2.26.2
#3 lore raw
Quoted 25 lines · Ed Wildgoose

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.

Fixes e09d168f13f0 ("gpio: AMD G-Series PCH gpio driver")
---
 drivers/gpio/gpio-amd-fch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-amd-fch.c +1 -2
index 4e44ba4d7..2a21354ed 100644
@@ -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,
--
Quoted 2 lines

2.26.2

Queued for fixes, thanks!

Bartosz