linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] misc: ti-fpc202: remove unneeded direction check
@ 2025-07-17 13:03 Bartosz Golaszewski
  2025-07-17 13:03 ` [PATCH 2/2] misc: ti-fpc202: use new GPIO line value setter callbacks Bartosz Golaszewski
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-07-17 13:03 UTC (permalink / raw)
  To: Romain Gantois, Arnd Bergmann, Greg Kroah-Hartman, Linus Walleij
  Cc: linux-kernel, linux-gpio, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

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.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/misc/ti_fpc202.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/misc/ti_fpc202.c b/drivers/misc/ti_fpc202.c
index f7cde245ac95..ca415ef45cbe 100644
--- a/drivers/misc/ti_fpc202.c
+++ b/drivers/misc/ti_fpc202.c
@@ -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);
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] misc: ti-fpc202: use new GPIO line value setter callbacks
  2025-07-17 13:03 [PATCH 1/2] misc: ti-fpc202: remove unneeded direction check Bartosz Golaszewski
@ 2025-07-17 13:03 ` Bartosz Golaszewski
  2025-07-17 13:32   ` Bartosz Golaszewski
                     ` (2 more replies)
  2025-07-17 14:33 ` [PATCH 1/2] misc: ti-fpc202: remove unneeded direction check Greg Kroah-Hartman
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-07-17 13:03 UTC (permalink / raw)
  To: Romain Gantois, Arnd Bergmann, Greg Kroah-Hartman, Linus Walleij
  Cc: linux-kernel, linux-gpio, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

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

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/misc/ti_fpc202.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/misc/ti_fpc202.c b/drivers/misc/ti_fpc202.c
index ca415ef45cbe..f84cae50e2c9 100644
--- a/drivers/misc/ti_fpc202.c
+++ b/drivers/misc/ti_fpc202.c
@@ -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;
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] misc: ti-fpc202: use new GPIO line value setter callbacks
  2025-07-17 13:03 ` [PATCH 2/2] misc: ti-fpc202: use new GPIO line value setter callbacks Bartosz Golaszewski
@ 2025-07-17 13:32   ` Bartosz Golaszewski
  2025-07-17 14:34     ` Greg Kroah-Hartman
  2025-07-17 14:33   ` Greg Kroah-Hartman
  2025-07-17 15:32   ` Romain Gantois
  2 siblings, 1 reply; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-07-17 13:32 UTC (permalink / raw)
  To: Romain Gantois, Arnd Bergmann, Greg Kroah-Hartman, Linus Walleij
  Cc: linux-kernel, linux-gpio, Bartosz Golaszewski

On Thu, Jul 17, 2025 at 3:04 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> struct gpio_chip now has callbacks for setting line values that return
> an integer, allowing to indicate failures. Convert the driver to using
> them.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] misc: ti-fpc202: remove unneeded direction check
  2025-07-17 13:03 [PATCH 1/2] misc: ti-fpc202: remove unneeded direction check Bartosz Golaszewski
  2025-07-17 13:03 ` [PATCH 2/2] misc: ti-fpc202: use new GPIO line value setter callbacks Bartosz Golaszewski
@ 2025-07-17 14:33 ` Greg Kroah-Hartman
  2025-07-17 15:26 ` Romain Gantois
  2025-07-18  7:55 ` Bartosz Golaszewski
  3 siblings, 0 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2025-07-17 14:33 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Romain Gantois, Arnd Bergmann, Linus Walleij, linux-kernel,
	linux-gpio, Bartosz Golaszewski

On Thu, Jul 17, 2025 at 03:03:55PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> 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.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] misc: ti-fpc202: use new GPIO line value setter callbacks
  2025-07-17 13:03 ` [PATCH 2/2] misc: ti-fpc202: use new GPIO line value setter callbacks Bartosz Golaszewski
  2025-07-17 13:32   ` Bartosz Golaszewski
@ 2025-07-17 14:33   ` Greg Kroah-Hartman
  2025-07-17 15:32   ` Romain Gantois
  2 siblings, 0 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2025-07-17 14:33 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Romain Gantois, Arnd Bergmann, Linus Walleij, linux-kernel,
	linux-gpio, Bartosz Golaszewski

On Thu, Jul 17, 2025 at 03:03:56PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> struct gpio_chip now has callbacks for setting line values that return
> an integer, allowing to indicate failures. Convert the driver to using
> them.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] misc: ti-fpc202: use new GPIO line value setter callbacks
  2025-07-17 13:32   ` Bartosz Golaszewski
@ 2025-07-17 14:34     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2025-07-17 14:34 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Romain Gantois, Arnd Bergmann, Linus Walleij, linux-kernel,
	linux-gpio, Bartosz Golaszewski

On Thu, Jul 17, 2025 at 03:32:07PM +0200, Bartosz Golaszewski wrote:
> On Thu, Jul 17, 2025 at 3:04 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > struct gpio_chip now has callbacks for setting line values that return
> > an integer, allowing to indicate failures. Convert the driver to using
> > them.
> >
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > ---
> 
> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] misc: ti-fpc202: remove unneeded direction check
  2025-07-17 13:03 [PATCH 1/2] misc: ti-fpc202: remove unneeded direction check Bartosz Golaszewski
  2025-07-17 13:03 ` [PATCH 2/2] misc: ti-fpc202: use new GPIO line value setter callbacks Bartosz Golaszewski
  2025-07-17 14:33 ` [PATCH 1/2] misc: ti-fpc202: remove unneeded direction check Greg Kroah-Hartman
@ 2025-07-17 15:26 ` Romain Gantois
  2025-07-18  7:55 ` Bartosz Golaszewski
  3 siblings, 0 replies; 9+ messages in thread
From: Romain Gantois @ 2025-07-17 15:26 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman, Linus Walleij,
	Bartosz Golaszewski
  Cc: linux-kernel, linux-gpio, Bartosz Golaszewski

[-- Attachment #1: Type: text/plain, Size: 1085 bytes --]

Hi Bartosz,

On Thursday, 17 July 2025 15:03:55 CEST Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> 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.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>  drivers/misc/ti_fpc202.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/misc/ti_fpc202.c b/drivers/misc/ti_fpc202.c
> index f7cde245ac95..ca415ef45cbe 100644
> --- a/drivers/misc/ti_fpc202.c
> +++ b/drivers/misc/ti_fpc202.c
> @@ -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);

LGTM

Reviewed-by: Romain Gantois <romain.gantois@bootlin.com>


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] misc: ti-fpc202: use new GPIO line value setter callbacks
  2025-07-17 13:03 ` [PATCH 2/2] misc: ti-fpc202: use new GPIO line value setter callbacks Bartosz Golaszewski
  2025-07-17 13:32   ` Bartosz Golaszewski
  2025-07-17 14:33   ` Greg Kroah-Hartman
@ 2025-07-17 15:32   ` Romain Gantois
  2 siblings, 0 replies; 9+ messages in thread
From: Romain Gantois @ 2025-07-17 15:32 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman, Linus Walleij,
	Bartosz Golaszewski
  Cc: linux-kernel, linux-gpio, Bartosz Golaszewski

[-- Attachment #1: Type: text/plain, Size: 2192 bytes --]

On Thursday, 17 July 2025 15:03:56 CEST Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> struct gpio_chip now has callbacks for setting line values that return
> an integer, allowing to indicate failures. Convert the driver to using
> them.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>  drivers/misc/ti_fpc202.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/misc/ti_fpc202.c b/drivers/misc/ti_fpc202.c
> index ca415ef45cbe..f84cae50e2c9 100644
> --- a/drivers/misc/ti_fpc202.c
> +++ b/drivers/misc/ti_fpc202.c
> @@ -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;

Reviewed-by: Romain Gantois <romain.gantois@bootlin.com>


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] misc: ti-fpc202: remove unneeded direction check
  2025-07-17 13:03 [PATCH 1/2] misc: ti-fpc202: remove unneeded direction check Bartosz Golaszewski
                   ` (2 preceding siblings ...)
  2025-07-17 15:26 ` Romain Gantois
@ 2025-07-18  7:55 ` Bartosz Golaszewski
  3 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-07-18  7:55 UTC (permalink / raw)
  To: Romain Gantois, Arnd Bergmann, Greg Kroah-Hartman, Linus Walleij,
	Bartosz Golaszewski
  Cc: Bartosz Golaszewski, linux-kernel, linux-gpio

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Thu, 17 Jul 2025 15:03:55 +0200, Bartosz Golaszewski wrote:
> 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,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-07-18  7:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-17 13:03 [PATCH 1/2] misc: ti-fpc202: remove unneeded direction check Bartosz Golaszewski
2025-07-17 13:03 ` [PATCH 2/2] misc: ti-fpc202: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-07-17 13:32   ` Bartosz Golaszewski
2025-07-17 14:34     ` Greg Kroah-Hartman
2025-07-17 14:33   ` Greg Kroah-Hartman
2025-07-17 15:32   ` Romain Gantois
2025-07-17 14:33 ` [PATCH 1/2] misc: ti-fpc202: remove unneeded direction check Greg Kroah-Hartman
2025-07-17 15:26 ` Romain Gantois
2025-07-18  7:55 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).