[PATCH 05/12] gpio: tqmx86: use new GPIO line value setter callbacks

Bartosz Golaszewski posted 12 patches 3 months ago
There is a newer version of this series
[PATCH 05/12] gpio: tqmx86: use new GPIO line value setter callbacks
Posted by Bartosz Golaszewski 3 months ago
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/gpio/gpio-tqmx86.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-tqmx86.c b/drivers/gpio/gpio-tqmx86.c
index 18f523a15b3c03e083b363a026e751f7367fb080..056799ecce6a256f3438d9fd81ee4677cdd20125 100644
--- a/drivers/gpio/gpio-tqmx86.c
+++ b/drivers/gpio/gpio-tqmx86.c
@@ -93,14 +93,16 @@ static void _tqmx86_gpio_set(struct tqmx86_gpio_data *gpio, unsigned int offset,
 	tqmx86_gpio_write(gpio, bitmap_get_value8(gpio->output, 0), TQMX86_GPIOD);
 }
 
-static void tqmx86_gpio_set(struct gpio_chip *chip, unsigned int offset,
-			    int value)
+static int tqmx86_gpio_set(struct gpio_chip *chip, unsigned int offset,
+			   int value)
 {
 	struct tqmx86_gpio_data *gpio = gpiochip_get_data(chip);
 
 	guard(raw_spinlock_irqsave)(&gpio->spinlock);
 
 	_tqmx86_gpio_set(gpio, offset, value);
+
+	return 0;
 }
 
 static int tqmx86_gpio_direction_input(struct gpio_chip *chip,
@@ -368,7 +370,7 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
 	chip->direction_output = tqmx86_gpio_direction_output;
 	chip->get_direction = tqmx86_gpio_get_direction;
 	chip->get = tqmx86_gpio_get;
-	chip->set = tqmx86_gpio_set;
+	chip->set_rv = tqmx86_gpio_set;
 	chip->ngpio = TQMX86_NGPIO;
 	chip->parent = pdev->dev.parent;
 

-- 
2.48.1
Re: [PATCH 05/12] gpio: tqmx86: use new GPIO line value setter callbacks
Posted by Matthias Schiffer 3 months ago
On Mon, 2025-07-07 at 09:50 +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: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>

> ---
>  drivers/gpio/gpio-tqmx86.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-tqmx86.c b/drivers/gpio/gpio-tqmx86.c
> index 18f523a15b3c03e083b363a026e751f7367fb080..056799ecce6a256f3438d9fd81ee4677cdd20125 100644
> --- a/drivers/gpio/gpio-tqmx86.c
> +++ b/drivers/gpio/gpio-tqmx86.c
> @@ -93,14 +93,16 @@ static void _tqmx86_gpio_set(struct tqmx86_gpio_data *gpio, unsigned int offset,
>  	tqmx86_gpio_write(gpio, bitmap_get_value8(gpio->output, 0), TQMX86_GPIOD);
>  }
>  
> -static void tqmx86_gpio_set(struct gpio_chip *chip, unsigned int offset,
> -			    int value)
> +static int tqmx86_gpio_set(struct gpio_chip *chip, unsigned int offset,
> +			   int value)
>  {
>  	struct tqmx86_gpio_data *gpio = gpiochip_get_data(chip);
>  
>  	guard(raw_spinlock_irqsave)(&gpio->spinlock);
>  
>  	_tqmx86_gpio_set(gpio, offset, value);
> +
> +	return 0;
>  }
>  
>  static int tqmx86_gpio_direction_input(struct gpio_chip *chip,
> @@ -368,7 +370,7 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
>  	chip->direction_output = tqmx86_gpio_direction_output;
>  	chip->get_direction = tqmx86_gpio_get_direction;
>  	chip->get = tqmx86_gpio_get;
> -	chip->set = tqmx86_gpio_set;
> +	chip->set_rv = tqmx86_gpio_set;
>  	chip->ngpio = TQMX86_NGPIO;
>  	chip->parent = pdev->dev.parent;
>  
> 

-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/