]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gpio: ts4900: use new GPIO line value setter callbacks
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 7 Jul 2025 07:50:19 +0000 (09:50 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Sun, 13 Jul 2025 08:45:04 +0000 (10:45 +0200)
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Link: https://lore.kernel.org/r/20250707-gpiochip-set-rv-gpio-round4-v1-6-35668aaaf6d2@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpio-ts4900.c

index 5c806140fdf0d6e60f2225824aa18d393f61b607..35dd2d09b4d441256f01d9ac762dd3a2f0a47352 100644 (file)
@@ -95,16 +95,16 @@ static int ts4900_gpio_get(struct gpio_chip *chip, unsigned int offset)
        return !!(reg & priv->input_bit);
 }
 
-static void ts4900_gpio_set(struct gpio_chip *chip, unsigned int offset,
-                           int value)
+static int ts4900_gpio_set(struct gpio_chip *chip, unsigned int offset,
+                          int value)
 {
        struct ts4900_gpio_priv *priv = gpiochip_get_data(chip);
 
        if (value)
-               regmap_update_bits(priv->regmap, offset, TS4900_GPIO_OUT,
-                                  TS4900_GPIO_OUT);
-       else
-               regmap_update_bits(priv->regmap, offset, TS4900_GPIO_OUT, 0);
+               return regmap_update_bits(priv->regmap, offset,
+                                         TS4900_GPIO_OUT, TS4900_GPIO_OUT);
+
+       return regmap_update_bits(priv->regmap, offset, TS4900_GPIO_OUT, 0);
 }
 
 static const struct regmap_config ts4900_regmap_config = {
@@ -119,7 +119,7 @@ static const struct gpio_chip template_chip = {
        .direction_input        = ts4900_gpio_direction_input,
        .direction_output       = ts4900_gpio_direction_output,
        .get                    = ts4900_gpio_get,
-       .set                    = ts4900_gpio_set,
+       .set_rv                 = ts4900_gpio_set,
        .base                   = -1,
        .can_sleep              = true,
 };