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

index 187d21580573fb1d896d90642a537a90aced8276..3204f55394cff12dc1b462cdce60342ed1b32fc1 100644 (file)
@@ -36,18 +36,18 @@ static int tps65910_gpio_get(struct gpio_chip *gc, unsigned offset)
        return 0;
 }
 
-static void tps65910_gpio_set(struct gpio_chip *gc, unsigned offset,
-                             int value)
+static int tps65910_gpio_set(struct gpio_chip *gc, unsigned int offset,
+                            int value)
 {
        struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc);
        struct tps65910 *tps65910 = tps65910_gpio->tps65910;
 
        if (value)
-               regmap_set_bits(tps65910->regmap, TPS65910_GPIO0 + offset,
-                                               GPIO_SET_MASK);
-       else
-               regmap_clear_bits(tps65910->regmap, TPS65910_GPIO0 + offset,
-                                               GPIO_SET_MASK);
+               return regmap_set_bits(tps65910->regmap,
+                                      TPS65910_GPIO0 + offset, GPIO_SET_MASK);
+
+       return regmap_clear_bits(tps65910->regmap, TPS65910_GPIO0 + offset,
+                                GPIO_SET_MASK);
 }
 
 static int tps65910_gpio_output(struct gpio_chip *gc, unsigned offset,
@@ -55,9 +55,12 @@ static int tps65910_gpio_output(struct gpio_chip *gc, unsigned offset,
 {
        struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc);
        struct tps65910 *tps65910 = tps65910_gpio->tps65910;
+       int ret;
 
        /* Set the initial value */
-       tps65910_gpio_set(gc, offset, value);
+       ret = tps65910_gpio_set(gc, offset, value);
+       if (ret)
+               return ret;
 
        return regmap_set_bits(tps65910->regmap, TPS65910_GPIO0 + offset,
                                                GPIO_CFG_MASK);
@@ -136,7 +139,7 @@ static int tps65910_gpio_probe(struct platform_device *pdev)
        tps65910_gpio->gpio_chip.can_sleep = true;
        tps65910_gpio->gpio_chip.direction_input = tps65910_gpio_input;
        tps65910_gpio->gpio_chip.direction_output = tps65910_gpio_output;
-       tps65910_gpio->gpio_chip.set    = tps65910_gpio_set;
+       tps65910_gpio->gpio_chip.set_rv = tps65910_gpio_set;
        tps65910_gpio->gpio_chip.get    = tps65910_gpio_get;
        tps65910_gpio->gpio_chip.parent = &pdev->dev;