]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
pinctrl: mediatek: moore: use new GPIO line value setter callbacks
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 25 Apr 2025 09:01:00 +0000 (11:01 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 9 May 2025 08:04:45 +0000 (10:04 +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/20250425-gpiochip-set-rv-pinctrl-mediatek-v1-4-93e6a01855e7@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/mediatek/pinctrl-moore.c

index aad4891223d3e060431a990bfabb6bd2cbb82087..827d0f1910310a6717adb4d61c3d395105806501 100644 (file)
@@ -496,24 +496,26 @@ static int mtk_gpio_get(struct gpio_chip *chip, unsigned int gpio)
        return !!value;
 }
 
-static void mtk_gpio_set(struct gpio_chip *chip, unsigned int gpio, int value)
+static int mtk_gpio_set(struct gpio_chip *chip, unsigned int gpio, int value)
 {
        struct mtk_pinctrl *hw = gpiochip_get_data(chip);
        const struct mtk_pin_desc *desc;
 
        desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio];
-       if (!desc->name) {
-               dev_err(hw->dev, "Failed to set gpio %d\n", gpio);
-               return;
-       }
+       if (!desc->name)
+               return -ENOTSUPP;
 
-       mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DO, !!value);
+       return mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DO, !!value);
 }
 
 static int mtk_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio,
                                     int value)
 {
-       mtk_gpio_set(chip, gpio, value);
+       int ret;
+
+       ret = mtk_gpio_set(chip, gpio, value);
+       if (ret)
+               return ret;
 
        return pinctrl_gpio_direction_output(chip, gpio);
 }
@@ -567,7 +569,7 @@ static int mtk_build_gpiochip(struct mtk_pinctrl *hw)
        chip->direction_input   = pinctrl_gpio_direction_input;
        chip->direction_output  = mtk_gpio_direction_output;
        chip->get               = mtk_gpio_get;
-       chip->set               = mtk_gpio_set;
+       chip->set_rv            = mtk_gpio_set;
        chip->to_irq            = mtk_gpio_to_irq;
        chip->set_config        = mtk_gpio_set_config;
        chip->base              = -1;