[Linux-stm32] [PATCH 05/12] pinctrl: stm32: use new GPIO line value setter callbacks

Antonio Borneo antonio.borneo at foss.st.com
Thu Apr 24 09:04:47 PDT 2025


On Thu, 2025-04-24 at 10:35 +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski at linaro.org>
> 
> 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 at linaro.org>

Reviewed-by: Antonio Borneo <antonio.borneo at foss.st.com>

> ---
>  drivers/pinctrl/stm32/pinctrl-stm32.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
> index cc0b4d1d7cff..ba49d48c3a1d 100644
> --- a/drivers/pinctrl/stm32/pinctrl-stm32.c
> +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
> @@ -228,11 +228,14 @@ static int stm32_gpio_get(struct gpio_chip *chip, unsigned offset)
>         return !!(readl_relaxed(bank->base + STM32_GPIO_IDR) & BIT(offset));
>  }
>  
> -static void stm32_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
> +static int stm32_gpio_set(struct gpio_chip *chip, unsigned int offset,
> +                         int value)
>  {
>         struct stm32_gpio_bank *bank = gpiochip_get_data(chip);
>  
>         __stm32_gpio_set(bank, offset, value);
> +
> +       return 0;
>  }
>  
>  static int stm32_gpio_direction_output(struct gpio_chip *chip,
> @@ -308,7 +311,7 @@ static const struct gpio_chip stm32_gpio_template = {
>         .request                = stm32_gpio_request,
>         .free                   = pinctrl_gpio_free,
>         .get                    = stm32_gpio_get,
> -       .set                    = stm32_gpio_set,
> +       .set_rv                 = stm32_gpio_set,
>         .direction_input        = pinctrl_gpio_direction_input,
>         .direction_output       = stm32_gpio_direction_output,
>         .to_irq                 = stm32_gpio_to_irq,
> 



More information about the linux-arm-kernel mailing list