diff mbox series

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

Message ID 20231003145114.21637-19-brgl@bgdev.pl
State Superseded
Headers show
Series pinctrl: don't use GPIOLIB global numberspace in helpers | expand

Commit Message

Bartosz Golaszewski Oct. 3, 2023, 2:50 p.m. UTC
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

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@linaro.org>
---
 drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c | 4 ++--
 drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Emil Renner Berthing Oct. 4, 2023, 9:37 a.m. UTC | #1
Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> 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@linaro.org>
> ---
>  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
Bartosz Golaszewski Oct. 4, 2023, 9:39 a.m. UTC | #2
On Wed, Oct 4, 2023 at 11:37 AM Emil Renner Berthing
<emil.renner.berthing@canonical.com> wrote:
>
> Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > 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@linaro.org>
> > ---
> >  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?

Ha! Make sense and it'll probably apply to more users.

>
> 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.
>

I wanted to reduce noise for maintainers but ended up introducing
confusion. I will probably just send the v2 to everyone so proper
context.

Bart

> /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
diff mbox series

Patch

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);
 }
 
 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,