]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
pinctrl: mediatek: common: use new GPIO line value setter callbacks
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 25 Apr 2025 09:01:01 +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-5-93e6a01855e7@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/mediatek/pinctrl-mtk-common.c

index 91edb539925a49b4302866b9ac36f580cc189fb5..7f22adcca904bd1b9792ed710e728987a8d817f3 100644 (file)
@@ -86,7 +86,7 @@ static int mtk_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
        return 0;
 }
 
-static void mtk_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
+static int mtk_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
 {
        unsigned int reg_addr;
        unsigned int bit;
@@ -100,7 +100,7 @@ static void mtk_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
        else
                reg_addr = CLR_ADDR(reg_addr, pctl);
 
-       regmap_write(mtk_get_regmap(pctl, offset), reg_addr, bit);
+       return regmap_write(mtk_get_regmap(pctl, offset), reg_addr, bit);
 }
 
 static int mtk_pconf_set_ies_smt(struct mtk_pinctrl *pctl, unsigned pin,
@@ -809,7 +809,12 @@ static const struct pinmux_ops mtk_pmx_ops = {
 static int mtk_gpio_direction_output(struct gpio_chip *chip,
                                        unsigned offset, int value)
 {
-       mtk_gpio_set(chip, offset, value);
+       int ret;
+
+       ret = mtk_gpio_set(chip, offset, value);
+       if (ret)
+               return ret;
+
        return pinctrl_gpio_direction_output(chip, offset);
 }
 
@@ -893,7 +898,7 @@ static const struct gpio_chip mtk_gpio_chip = {
        .direction_input        = pinctrl_gpio_direction_input,
        .direction_output       = mtk_gpio_direction_output,
        .get                    = mtk_gpio_get,
-       .set                    = mtk_gpio_set,
+       .set_rv                 = mtk_gpio_set,
        .to_irq                 = mtk_gpio_to_irq,
        .set_config             = mtk_gpio_set_config,
 };