Skip to content

Commit 8a3f17d

Browse files
Bartosz GolaszewskiLinus Walleij
authored andcommitted
pinctrl: mediatek: moore: 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-4-93e6a01855e7@linaro.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 1849d1a commit 8a3f17d

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

drivers/pinctrl/mediatek/pinctrl-moore.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -496,24 +496,26 @@ static int mtk_gpio_get(struct gpio_chip *chip, unsigned int gpio)
496496
return !!value;
497497
}
498498

499-
static void mtk_gpio_set(struct gpio_chip *chip, unsigned int gpio, int value)
499+
static int mtk_gpio_set(struct gpio_chip *chip, unsigned int gpio, int value)
500500
{
501501
struct mtk_pinctrl *hw = gpiochip_get_data(chip);
502502
const struct mtk_pin_desc *desc;
503503

504504
desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio];
505-
if (!desc->name) {
506-
dev_err(hw->dev, "Failed to set gpio %d\n", gpio);
507-
return;
508-
}
505+
if (!desc->name)
506+
return -ENOTSUPP;
509507

510-
mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DO, !!value);
508+
return mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DO, !!value);
511509
}
512510

513511
static int mtk_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio,
514512
int value)
515513
{
516-
mtk_gpio_set(chip, gpio, value);
514+
int ret;
515+
516+
ret = mtk_gpio_set(chip, gpio, value);
517+
if (ret)
518+
return ret;
517519

518520
return pinctrl_gpio_direction_output(chip, gpio);
519521
}
@@ -567,7 +569,7 @@ static int mtk_build_gpiochip(struct mtk_pinctrl *hw)
567569
chip->direction_input = pinctrl_gpio_direction_input;
568570
chip->direction_output = mtk_gpio_direction_output;
569571
chip->get = mtk_gpio_get;
570-
chip->set = mtk_gpio_set;
572+
chip->set_rv = mtk_gpio_set;
571573
chip->to_irq = mtk_gpio_to_irq;
572574
chip->set_config = mtk_gpio_set_config;
573575
chip->base = -1;

0 commit comments

Comments
 (0)