Skip to content

Commit 23a5fa3

Browse files
Bartosz GolaszewskiLinus Walleij
authored andcommitted
pinctrl: mediatek: common: use new GPIO line value setter callbacks
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>
1 parent 8a3f17d commit 23a5fa3

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

drivers/pinctrl/mediatek/pinctrl-mtk-common.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static int mtk_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
8686
return 0;
8787
}
8888

89-
static void mtk_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
89+
static int mtk_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
9090
{
9191
unsigned int reg_addr;
9292
unsigned int bit;
@@ -100,7 +100,7 @@ static void mtk_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
100100
else
101101
reg_addr = CLR_ADDR(reg_addr, pctl);
102102

103-
regmap_write(mtk_get_regmap(pctl, offset), reg_addr, bit);
103+
return regmap_write(mtk_get_regmap(pctl, offset), reg_addr, bit);
104104
}
105105

106106
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 = {
809809
static int mtk_gpio_direction_output(struct gpio_chip *chip,
810810
unsigned offset, int value)
811811
{
812-
mtk_gpio_set(chip, offset, value);
812+
int ret;
813+
814+
ret = mtk_gpio_set(chip, offset, value);
815+
if (ret)
816+
return ret;
817+
813818
return pinctrl_gpio_direction_output(chip, offset);
814819
}
815820

@@ -893,7 +898,7 @@ static const struct gpio_chip mtk_gpio_chip = {
893898
.direction_input = pinctrl_gpio_direction_input,
894899
.direction_output = mtk_gpio_direction_output,
895900
.get = mtk_gpio_get,
896-
.set = mtk_gpio_set,
901+
.set_rv = mtk_gpio_set,
897902
.to_irq = mtk_gpio_to_irq,
898903
.set_config = mtk_gpio_set_config,
899904
};

0 commit comments

Comments
 (0)