diff mbox series

[11/15] gpio: arizona: use new line value setter callbacks

Message ID 20250303-gpiochip-set-conversion-v1-11-1d5cceeebf8b@linaro.org (mailing list archive)
State New, archived
Headers show
Series gpio: convert more drivers to using the new value setters | expand

Commit Message

Bartosz Golaszewski March 3, 2025, 1:18 p.m. UTC
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-arizona.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Richard Fitzgerald March 3, 2025, 1:33 p.m. UTC | #1
On 03/03/2025 1:18 pm, 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/gpio/gpio-arizona.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-arizona.c b/drivers/gpio/gpio-arizona.c
> index c15fda99120a..e530c94dcce8 100644
> --- a/drivers/gpio/gpio-arizona.c
> +++ b/drivers/gpio/gpio-arizona.c
> @@ -121,7 +121,8 @@ static int arizona_gpio_direction_out(struct gpio_chip *chip,
>   				  ARIZONA_GPN_DIR | ARIZONA_GPN_LVL, value);
>   }
>   
> -static void arizona_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
> +static int arizona_gpio_set(struct gpio_chip *chip, unsigned int offset,
> +			    int value)
>   {
>   	struct arizona_gpio *arizona_gpio = gpiochip_get_data(chip);
>   	struct arizona *arizona = arizona_gpio->arizona;
> @@ -129,8 +130,8 @@ static void arizona_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
>   	if (value)
>   		value = ARIZONA_GPN_LVL;
>   
> -	regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset,
> -			   ARIZONA_GPN_LVL, value);
> +	return regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset,
> +				  ARIZONA_GPN_LVL, value);
>   }
>   
>   static const struct gpio_chip template_chip = {
> @@ -139,7 +140,7 @@ static const struct gpio_chip template_chip = {
>   	.direction_input	= arizona_gpio_direction_in,
>   	.get			= arizona_gpio_get,
>   	.direction_output	= arizona_gpio_direction_out,
> -	.set			= arizona_gpio_set,
> +	.set_rv			= arizona_gpio_set,
>   	.can_sleep		= true,
>   };
>   
> 
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-arizona.c b/drivers/gpio/gpio-arizona.c
index c15fda99120a..e530c94dcce8 100644
--- a/drivers/gpio/gpio-arizona.c
+++ b/drivers/gpio/gpio-arizona.c
@@ -121,7 +121,8 @@  static int arizona_gpio_direction_out(struct gpio_chip *chip,
 				  ARIZONA_GPN_DIR | ARIZONA_GPN_LVL, value);
 }
 
-static void arizona_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
+static int arizona_gpio_set(struct gpio_chip *chip, unsigned int offset,
+			    int value)
 {
 	struct arizona_gpio *arizona_gpio = gpiochip_get_data(chip);
 	struct arizona *arizona = arizona_gpio->arizona;
@@ -129,8 +130,8 @@  static void arizona_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 	if (value)
 		value = ARIZONA_GPN_LVL;
 
-	regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset,
-			   ARIZONA_GPN_LVL, value);
+	return regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset,
+				  ARIZONA_GPN_LVL, value);
 }
 
 static const struct gpio_chip template_chip = {
@@ -139,7 +140,7 @@  static const struct gpio_chip template_chip = {
 	.direction_input	= arizona_gpio_direction_in,
 	.get			= arizona_gpio_get,
 	.direction_output	= arizona_gpio_direction_out,
-	.set			= arizona_gpio_set,
+	.set_rv			= arizona_gpio_set,
 	.can_sleep		= true,
 };