Re: [PATCH 18/36] pinctrl: starfive: use new pinctrl GPIO helpers

From: Emil Renner Berthing
Date: Wed Oct 04 2023 - 05:37:19 EST


Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
>
> Replace the pinctrl helpers taking the global GPIO number as argument
> with the improved variants that instead take a pointer to the GPIO chip
> and the controller-relative offset.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> ---
> drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c | 4 ++--
> drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
> index 530fe340a9a1..22a2db8fa315 100644
> --- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
> +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
> @@ -918,12 +918,12 @@ static struct pinctrl_desc starfive_desc = {
>
> static int starfive_gpio_request(struct gpio_chip *gc, unsigned int gpio)
> {
> - return pinctrl_gpio_request(gc->base + gpio);
> + return pinctrl_gpio_request_new(gc, gpio);
> }
>
> static void starfive_gpio_free(struct gpio_chip *gc, unsigned int gpio)
> {
> - pinctrl_gpio_free(gc->base + gpio);
> + pinctrl_gpio_free_new(gc, gpio);

Hi Bartosz,

Thank you for the patch. These new pinctrl_gpio_*_new() functions now seem to
have the same signature as the starfive_gpio_*() functions. Is there a reason
they can't be used as callbacks directly so we could just delete the
starfive_gpio_*() wrapppers?

Also it'd be great to be to be CC'd on at least the first generic patches where
the new functions are introduced to have some context without having to look it
up on lore.

/Emil

> }
>
> static int starfive_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
> diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
> index 640f827a9b2c..5557ef3fbeb2 100644
> --- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
> +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
> @@ -547,12 +547,12 @@ static const struct pinconf_ops jh7110_pinconf_ops = {
>
> static int jh7110_gpio_request(struct gpio_chip *gc, unsigned int gpio)
> {
> - return pinctrl_gpio_request(gc->base + gpio);
> + return pinctrl_gpio_request_new(gc, gpio);
> }
>
> static void jh7110_gpio_free(struct gpio_chip *gc, unsigned int gpio)
> {
> - pinctrl_gpio_free(gc->base + gpio);
> + pinctrl_gpio_free_new(gc, gpio);
> }
>
> static int jh7110_gpio_get_direction(struct gpio_chip *gc,
> --
> 2.39.2