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

index b9171bf66168f054e9eddef8417bef6d8f197f3c..b9c0d54d12f43242444f12a2bd8b6988d1511466 100644 (file)
@@ -44,7 +44,8 @@ static int twl6040gpo_direction_out(struct gpio_chip *chip, unsigned offset,
        return 0;
 }
 
-static void twl6040gpo_set(struct gpio_chip *chip, unsigned offset, int value)
+static int twl6040gpo_set(struct gpio_chip *chip, unsigned int offset,
+                         int value)
 {
        struct twl6040 *twl6040 = gpiochip_get_data(chip);
        int ret;
@@ -52,14 +53,14 @@ static void twl6040gpo_set(struct gpio_chip *chip, unsigned offset, int value)
 
        ret = twl6040_reg_read(twl6040, TWL6040_REG_GPOCTL);
        if (ret < 0)
-               return;
+               return ret;
 
        if (value)
                gpoctl = ret | BIT(offset);
        else
                gpoctl = ret & ~BIT(offset);
 
-       twl6040_reg_write(twl6040, TWL6040_REG_GPOCTL, gpoctl);
+       return twl6040_reg_write(twl6040, TWL6040_REG_GPOCTL, gpoctl);
 }
 
 static struct gpio_chip twl6040gpo_chip = {
@@ -68,7 +69,7 @@ static struct gpio_chip twl6040gpo_chip = {
        .get                    = twl6040gpo_get,
        .direction_output       = twl6040gpo_direction_out,
        .get_direction          = twl6040gpo_get_direction,
-       .set                    = twl6040gpo_set,
+       .set_rv                 = twl6040gpo_set,
        .can_sleep              = true,
 };