pinctrl: ocelot: use new GPIO line value setter callbacks
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 8 Apr 2025 07:17:46 +0000 (09:17 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 17 Apr 2025 07:39:15 +0000 (09:39 +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/20250408-gpiochip-set-rv-pinctrl-part1-v1-9-c9d521d7c8c7@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-ocelot.c

index 329d54b115298bb1835dfed115420ae49e952c23..fbb3d43746bba9be5a043e33fee10cc6fe3b82d1 100644 (file)
@@ -1950,17 +1950,18 @@ static int ocelot_gpio_get(struct gpio_chip *chip, unsigned int offset)
        return !!(val & BIT(offset % 32));
 }
 
-static void ocelot_gpio_set(struct gpio_chip *chip, unsigned int offset,
-                           int value)
+static int ocelot_gpio_set(struct gpio_chip *chip, unsigned int offset,
+                          int value)
 {
        struct ocelot_pinctrl *info = gpiochip_get_data(chip);
 
        if (value)
-               regmap_write(info->map, REG(OCELOT_GPIO_OUT_SET, info, offset),
-                            BIT(offset % 32));
-       else
-               regmap_write(info->map, REG(OCELOT_GPIO_OUT_CLR, info, offset),
-                            BIT(offset % 32));
+               return regmap_write(info->map,
+                                   REG(OCELOT_GPIO_OUT_SET, info, offset),
+                                   BIT(offset % 32));
+
+       return regmap_write(info->map, REG(OCELOT_GPIO_OUT_CLR, info, offset),
+                           BIT(offset % 32));
 }
 
 static int ocelot_gpio_get_direction(struct gpio_chip *chip,
@@ -1996,7 +1997,7 @@ static int ocelot_gpio_direction_output(struct gpio_chip *chip,
 static const struct gpio_chip ocelot_gpiolib_chip = {
        .request = gpiochip_generic_request,
        .free = gpiochip_generic_free,
-       .set = ocelot_gpio_set,
+       .set_rv = ocelot_gpio_set,
        .get = ocelot_gpio_get,
        .get_direction = ocelot_gpio_get_direction,
        .direction_input = pinctrl_gpio_direction_input,