]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
pinctrl: as3722: use new GPIO line value setter callbacks
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Thu, 12 Jun 2025 13:15:24 +0000 (15:15 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 18 Jun 2025 12:08:38 +0000 (14:08 +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.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/20250612-gpiochip-set-rv-pinctrl-remaining-v1-15-556b0a530cd4@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-as3722.c

index ed7b2c482ff0bb6a546955c083ef7046701527b0..30ed758bbe9d74fa943f56ed0c2951eccd972f34 100644 (file)
@@ -473,8 +473,8 @@ static int as3722_gpio_get(struct gpio_chip *chip, unsigned offset)
        return (invert_enable) ? !val : val;
 }
 
-static void as3722_gpio_set(struct gpio_chip *chip, unsigned offset,
-               int value)
+static int as3722_gpio_set(struct gpio_chip *chip, unsigned int offset,
+                          int value)
 {
        struct as3722_pctrl_info *as_pci = gpiochip_get_data(chip);
        struct as3722 *as3722 = as_pci->as3722;
@@ -486,7 +486,7 @@ static void as3722_gpio_set(struct gpio_chip *chip, unsigned offset,
        if (ret < 0) {
                dev_err(as_pci->dev,
                        "GPIO_CONTROL%d_REG read failed: %d\n", offset, ret);
-               return;
+               return ret;
        }
        en_invert = !!(val & AS3722_GPIO_INV);
 
@@ -500,12 +500,19 @@ static void as3722_gpio_set(struct gpio_chip *chip, unsigned offset,
        if (ret < 0)
                dev_err(as_pci->dev,
                        "GPIO_SIGNAL_OUT_REG update failed: %d\n", ret);
+
+       return ret;
 }
 
 static int as3722_gpio_direction_output(struct gpio_chip *chip,
-               unsigned offset, int value)
+                                       unsigned int offset, int value)
 {
-       as3722_gpio_set(chip, offset, value);
+       int ret;
+
+       ret = as3722_gpio_set(chip, offset, value);
+       if (ret)
+               return ret;
+
        return pinctrl_gpio_direction_output(chip, offset);
 }
 
@@ -522,7 +529,7 @@ static const struct gpio_chip as3722_gpio_chip = {
        .request                = gpiochip_generic_request,
        .free                   = gpiochip_generic_free,
        .get                    = as3722_gpio_get,
-       .set                    = as3722_gpio_set,
+       .set_rv                 = as3722_gpio_set,
        .direction_input        = pinctrl_gpio_direction_input,
        .direction_output       = as3722_gpio_direction_output,
        .to_irq                 = as3722_gpio_to_irq,