]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
pinctrl: stmfx: use new GPIO line value setter callbacks
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Thu, 24 Apr 2025 08:35:26 +0000 (10:35 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 29 Apr 2025 08:34:45 +0000 (10:34 +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>
Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/20250424-gpiochip-set-rv-pinctrl-part2-v1-3-504f91120b99@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-stmfx.c

index aae01120dc5224cbe87e0298e371d73c01cc4158..f4fdcaa043e6a5e69a2e168457b07a1fe0372cfb 100644 (file)
@@ -115,14 +115,14 @@ static int stmfx_gpio_get(struct gpio_chip *gc, unsigned int offset)
        return ret ? ret : !!(value & mask);
 }
 
-static void stmfx_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
+static int stmfx_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
 {
        struct stmfx_pinctrl *pctl = gpiochip_get_data(gc);
        u32 reg = value ? STMFX_REG_GPO_SET : STMFX_REG_GPO_CLR;
        u32 mask = get_mask(offset);
 
-       regmap_write_bits(pctl->stmfx->map, reg + get_reg(offset),
-                         mask, mask);
+       return regmap_write_bits(pctl->stmfx->map, reg + get_reg(offset),
+                                mask, mask);
 }
 
 static int stmfx_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
@@ -161,8 +161,11 @@ static int stmfx_gpio_direction_output(struct gpio_chip *gc,
        struct stmfx_pinctrl *pctl = gpiochip_get_data(gc);
        u32 reg = STMFX_REG_GPIO_DIR + get_reg(offset);
        u32 mask = get_mask(offset);
+       int ret;
 
-       stmfx_gpio_set(gc, offset, value);
+       ret = stmfx_gpio_set(gc, offset, value);
+       if (ret)
+               return ret;
 
        return regmap_write_bits(pctl->stmfx->map, reg, mask, mask);
 }
@@ -694,7 +697,7 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev)
        pctl->gpio_chip.direction_input = stmfx_gpio_direction_input;
        pctl->gpio_chip.direction_output = stmfx_gpio_direction_output;
        pctl->gpio_chip.get = stmfx_gpio_get;
-       pctl->gpio_chip.set = stmfx_gpio_set;
+       pctl->gpio_chip.set_rv = stmfx_gpio_set;
        pctl->gpio_chip.set_config = gpiochip_generic_config;
        pctl->gpio_chip.base = -1;
        pctl->gpio_chip.ngpio = pctl->pctl_desc.npins;