Skip to contentSkip to conversation

misc: ti-fpc202: remove unneeded direction check

PATCH Applied Bartosz Golaszewski 3 participants 9 messages Jul 17, 2025 – Jul 18, 2025

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

PATCH 1/2 misc: ti-fpc202: remove unneeded direction check

From: Bartosz Golaszewski <[email protected]>

As of commit 92ac7de3175e3 ("gpiolib: don't allow setting values on input lines"), the GPIO core makes sure values cannot be set on input lines. Remove the unnecessary check.

---
 drivers/misc/ti_fpc202.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/misc/ti_fpc202.c +0 -3
index f7cde245ac95..ca415ef45cbe 100644
@@ -125,9 +125,6 @@ static void fpc202_gpio_set(struct gpio_chip *chip, unsigned int offset,
 	int ret;
 	u8 val;
 
-	if (fpc202_gpio_get_dir(offset) == GPIO_LINE_DIRECTION_IN)
-		return;
-
 	ret = fpc202_read(priv, FPC202_REG_OUT_A_OUT_B_VAL);
 	if (ret < 0) {
 		dev_err(&priv->client->dev, "Failed to set GPIO %d value! err %d\n", offset, ret);
Signature · 1 line
2.48.1
#1 lore raw

PATCH 2/2 misc: ti-fpc202: use new GPIO line value setter callbacks

From: Bartosz Golaszewski <[email protected]>

struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them.

---
 drivers/misc/ti_fpc202.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/misc/ti_fpc202.c +5 -5
index ca415ef45cbe..f84cae50e2c9 100644
@@ -118,8 +118,8 @@ static void fpc202_set_enable(struct fpc202_priv *priv, int enable)
 	gpiod_set_value(priv->en_gpio, enable);
 }
 
-static void fpc202_gpio_set(struct gpio_chip *chip, unsigned int offset,
-			    int value)
+static int fpc202_gpio_set(struct gpio_chip *chip, unsigned int offset,
+			   int value)
 {
 	struct fpc202_priv *priv = gpiochip_get_data(chip);
 	int ret;
@@ -128,7 +128,7 @@ static void fpc202_gpio_set(struct gpio_chip *chip, unsigned int offset,
 	ret = fpc202_read(priv, FPC202_REG_OUT_A_OUT_B_VAL);
 	if (ret < 0) {
 		dev_err(&priv->client->dev, "Failed to set GPIO %d value! err %d\n", offset, ret);
-		return;
+		return ret;
 	}
 
 	val = (u8)ret;
@@ -138,7 +138,7 @@ static void fpc202_gpio_set(struct gpio_chip *chip, unsigned int offset,
 	else
 		val &= ~BIT(offset - FPC202_GPIO_P0_S0_OUT_A);
 
-	fpc202_write(priv, FPC202_REG_OUT_A_OUT_B_VAL, val);
+	return fpc202_write(priv, FPC202_REG_OUT_A_OUT_B_VAL, val);
 }
 
 static int fpc202_gpio_get(struct gpio_chip *chip, unsigned int offset)
@@ -333,7 +333,7 @@ static int fpc202_probe(struct i2c_client *client)
 	priv->gpio.base = -1;
 	priv->gpio.direction_input = fpc202_gpio_direction_input;
 	priv->gpio.direction_output = fpc202_gpio_direction_output;
-	priv->gpio.set = fpc202_gpio_set;
+	priv->gpio.set_rv = fpc202_gpio_set;
 	priv->gpio.get = fpc202_gpio_get;
 	priv->gpio.ngpio = FPC202_GPIO_COUNT;
 	priv->gpio.parent = dev;
Signature · 1 line
2.48.1
#2 lore raw

Re: [PATCH 2/2] misc: ti-fpc202: use new GPIO line value setter callbacks

Quoted 9 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them.

---

Greg: this patch comes in late into the cycle but the driver in question got merged for v6.16-rc1 despite the set() callback in struct gpio_chip being already deprecated and it went below my radar. This is one of the few remaining conversions and if we get it queued for v6.17, we'll be able to complete it next release and drop legacy callbacks. I know you're busy so if you could Ack it (and I hope I can get a review from Romain and Linus), I'm more than happy to take it through the GPIO tree to speed up the process.

Thanks,
Bartosz

#3 lore raw

Re: [PATCH 2/2] misc: ti-fpc202: use new GPIO line value setter callbacks

Quoted 11 lines · Bartosz Golaszewski
Quoted 9 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them.

---

Quoted 8 lines

Greg: this patch comes in late into the cycle but the driver in question got merged for v6.16-rc1 despite the set() callback in struct gpio_chip being already deprecated and it went below my radar. This is one of the few remaining conversions and if we get it queued for v6.17, we'll be able to complete it next release and drop legacy callbacks. I know you're busy so if you could Ack it (and I hope I can get a review from Romain and Linus), I'm more than happy to take it through the GPIO tree to speed up the process.

No worries, please take it through your tree, now acked.

greg k-h

maintainer Acked-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] misc: ti-fpc202: use new GPIO line value setter callbacks

In reply to Bartosz Golaszewski
Quoted 7 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them.

maintainer Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] misc: ti-fpc202: use new GPIO line value setter callbacks

In reply to Bartosz Golaszewski
Quoted 27 lines · On Thursday, 17 July 2025 15:03:56 CEST Bartosz Golaszewski wrote:

From: Bartosz Golaszewski <[email protected]>

struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them.

---
 drivers/misc/ti_fpc202.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/misc/ti_fpc202.c +2 -2
index ca415ef45cbe..f84cae50e2c9 100644
@@ -118,8 +118,8 @@ static void fpc202_set_enable(struct fpc202_priv *priv,
 int enable) gpiod_set_value(priv->en_gpio, enable);
 }
 
-static void fpc202_gpio_set(struct gpio_chip *chip, unsigned int offset,
-			    int value)
+static int fpc202_gpio_set(struct gpio_chip *chip, unsigned int offset,
+			   int value)
 {
 	struct fpc202_priv *priv = gpiochip_get_data(chip);
 	int ret;

drivers/misc/ti_fpc202.c static void fpc202_gpio_set(struct gpio_chip *chip, · line 130

Quoted 3 lines
drivers/misc/ti_fpc202.c +0 -0
@@ -128,7 +128,7 @@ static void fpc202_gpio_set(struct gpio_chip *chip,
 unsigned int offset, ret = fpc202_read(priv, FPC202_REG_OUT_A_OUT_B_VAL);
 	if (ret < 0) {
 		dev_err(&priv->client->dev, "Failed to set GPIO %d value! err 

%d\n",

Quoted 15 lines
drivers/misc/ti_fpc202.c +1 -0
 offset, ret); -		return;
+		return ret;
 	}
 
 	val = (u8)ret;
@@ -138,7 +138,7 @@ static void fpc202_gpio_set(struct gpio_chip *chip,

unsigned int offset, else

drivers/misc/ti_fpc202.c +1 -1
 		val &= ~BIT(offset - FPC202_GPIO_P0_S0_OUT_A);
 
-	fpc202_write(priv, FPC202_REG_OUT_A_OUT_B_VAL, val);
+	return fpc202_write(priv, FPC202_REG_OUT_A_OUT_B_VAL, val);
 }
 
 static int fpc202_gpio_get(struct gpio_chip *chip, unsigned int offset)

drivers/misc/ti_fpc202.c static int fpc202_probe(struct i2c_client *client) · line 339

Quoted 8 lines
drivers/misc/ti_fpc202.c +1 -1
@@ -333,7 +333,7 @@ static int fpc202_probe(struct i2c_client *client)
 	priv->gpio.base = -1;
 	priv->gpio.direction_input = fpc202_gpio_direction_input;
 	priv->gpio.direction_output = fpc202_gpio_direction_output;
-	priv->gpio.set = fpc202_gpio_set;
+	priv->gpio.set_rv = fpc202_gpio_set;
 	priv->gpio.get = fpc202_gpio_get;
 	priv->gpio.ngpio = FPC202_GPIO_COUNT;
 	priv->gpio.parent = dev;
maintainer Reviewed-by on v1 1/2
#7 lore raw
In reply to Bartosz Golaszewski

Hi Bartosz,

Quoted 16 lines · On Thursday, 17 July 2025 15:03:55 CEST Bartosz Golaszewski wrote:

From: Bartosz Golaszewski <[email protected]>

As of commit 92ac7de3175e3 ("gpiolib: don't allow setting values on input lines"), the GPIO core makes sure values cannot be set on input lines. Remove the unnecessary check.

---
 drivers/misc/ti_fpc202.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/misc/ti_fpc202.c +0 -0
index f7cde245ac95..ca415ef45cbe 100644

drivers/misc/ti_fpc202.c static void fpc202_gpio_set(struct gpio_chip *chip, · line 130

Quoted 9 lines
drivers/misc/ti_fpc202.c +0 -3
@@ -125,9 +125,6 @@ static void fpc202_gpio_set(struct gpio_chip *chip,
 unsigned int offset, int ret;
 	u8 val;
 
-	if (fpc202_gpio_get_dir(offset) == GPIO_LINE_DIRECTION_IN)
-		return;
-
 	ret = fpc202_read(priv, FPC202_REG_OUT_A_OUT_B_VAL);
 	if (ret < 0) {
 		dev_err(&priv->client->dev, "Failed to set GPIO %d value! err 

%d\n",

Quoted 1 line

offset, ret);

LGTM

author Applied
#8 lore raw
In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Quoted 5 lines · Bartosz Golaszewski

As of commit 92ac7de3175e3 ("gpiolib: don't allow setting values on input lines"), the GPIO core makes sure values cannot be set on input lines. Remove the unnecessary check.

Applied, thanks!

[1/2] misc: ti-fpc202: remove unneeded direction check

      https://git.kernel.org/brgl/linux/c/db7897ad60fd7d7bf471bc1c49e3d01fefadade3
[2/2] misc: ti-fpc202: use new GPIO line value setter callbacks
      https://git.kernel.org/brgl/linux/c/74896eae7e040e1b2a381efc8df0c839023dbf16

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>