]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gpio: tps68470: use new GPIO line value setter callbacks
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 7 Jul 2025 07:50:17 +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-4-35668aaaf6d2@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpio-tps68470.c

index 532deaddfd4e2e2f306f3872e746ad4d85925893..3b8805c854f7dbf4ae96fc06afaeb775bbdcacb1 100644 (file)
@@ -70,8 +70,8 @@ static int tps68470_gpio_get_direction(struct gpio_chip *gc,
                                                    GPIO_LINE_DIRECTION_IN;
 }
 
-static void tps68470_gpio_set(struct gpio_chip *gc, unsigned int offset,
-                               int value)
+static int tps68470_gpio_set(struct gpio_chip *gc, unsigned int offset,
+                            int value)
 {
        struct tps68470_gpio_data *tps68470_gpio = gpiochip_get_data(gc);
        struct regmap *regmap = tps68470_gpio->tps68470_regmap;
@@ -82,7 +82,8 @@ static void tps68470_gpio_set(struct gpio_chip *gc, unsigned int offset,
                offset -= TPS68470_N_REGULAR_GPIO;
        }
 
-       regmap_update_bits(regmap, reg, BIT(offset), value ? BIT(offset) : 0);
+       return regmap_update_bits(regmap, reg, BIT(offset),
+                                 value ? BIT(offset) : 0);
 }
 
 static int tps68470_gpio_output(struct gpio_chip *gc, unsigned int offset,
@@ -90,9 +91,12 @@ static int tps68470_gpio_output(struct gpio_chip *gc, unsigned int offset,
 {
        struct tps68470_gpio_data *tps68470_gpio = gpiochip_get_data(gc);
        struct regmap *regmap = tps68470_gpio->tps68470_regmap;
+       int ret;
 
        /* Set the initial value */
-       tps68470_gpio_set(gc, offset, value);
+       ret = tps68470_gpio_set(gc, offset, value);
+       if (ret)
+               return ret;
 
        /* rest are always outputs */
        if (offset >= TPS68470_N_REGULAR_GPIO)
@@ -138,7 +142,7 @@ static int tps68470_gpio_probe(struct platform_device *pdev)
        tps68470_gpio->gc.direction_output = tps68470_gpio_output;
        tps68470_gpio->gc.get = tps68470_gpio_get;
        tps68470_gpio->gc.get_direction = tps68470_gpio_get_direction;
-       tps68470_gpio->gc.set = tps68470_gpio_set;
+       tps68470_gpio->gc.set_rv = tps68470_gpio_set;
        tps68470_gpio->gc.can_sleep = true;
        tps68470_gpio->gc.names = tps68470_names;
        tps68470_gpio->gc.ngpio = TPS68470_N_GPIO;