* [PATCH] pinctrl: starfive: use dynamic GPIO base allocation
@ 2025-10-21 18:16 Ali Tariq
2025-10-22 7:23 ` Bartosz Golaszewski
0 siblings, 1 reply; 6+ messages in thread
From: Ali Tariq @ 2025-10-21 18:16 UTC (permalink / raw)
To: Linus Walleij, linux-gpio
Cc: Emil Renner Berthing, Hal Feng, linux-kernel, Ali Tariq
The JH7110 pinctrl driver currently sets a static GPIO base number from
platform data:
sfp->gc.base = info->gc_base;
Static base assignment is deprecated and results in the following warning:
gpio gpiochip0: Static allocation of GPIO base is deprecated,
use dynamic allocation.
Set `sfp->gc.base = -1` to let the GPIO core dynamically allocate
the base number. This removes the warning and aligns the driver
with current GPIO guidelines.
Tested on VisionFive 2 (JH7110 SoC).
Signed-off-by: Ali Tariq <alitariq45892@gmail.com>
---
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
index 05e3af75b09f..eb5cf8c067d1 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
@@ -938,7 +938,7 @@ int jh7110_pinctrl_probe(struct platform_device *pdev)
sfp->gc.set = jh7110_gpio_set;
sfp->gc.set_config = jh7110_gpio_set_config;
sfp->gc.add_pin_ranges = jh7110_gpio_add_pin_ranges;
- sfp->gc.base = info->gc_base;
+ sfp->gc.base = -1;
sfp->gc.ngpio = info->ngpios;
jh7110_irq_chip.name = sfp->gc.label;
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] pinctrl: starfive: use dynamic GPIO base allocation
2025-10-21 18:16 [PATCH] pinctrl: starfive: use dynamic GPIO base allocation Ali Tariq
@ 2025-10-22 7:23 ` Bartosz Golaszewski
2025-10-23 12:18 ` Emil Renner Berthing
0 siblings, 1 reply; 6+ messages in thread
From: Bartosz Golaszewski @ 2025-10-22 7:23 UTC (permalink / raw)
To: Ali Tariq
Cc: Linus Walleij, linux-gpio, Emil Renner Berthing, Hal Feng, linux-kernel
On Tue, Oct 21, 2025 at 8:17 PM Ali Tariq <alitariq45892@gmail.com> wrote:
>
> The JH7110 pinctrl driver currently sets a static GPIO base number from
> platform data:
>
> sfp->gc.base = info->gc_base;
>
> Static base assignment is deprecated and results in the following warning:
>
> gpio gpiochip0: Static allocation of GPIO base is deprecated,
> use dynamic allocation.
>
> Set `sfp->gc.base = -1` to let the GPIO core dynamically allocate
> the base number. This removes the warning and aligns the driver
> with current GPIO guidelines.
>
> Tested on VisionFive 2 (JH7110 SoC).
>
> Signed-off-by: Ali Tariq <alitariq45892@gmail.com>
> ---
> drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
> index 05e3af75b09f..eb5cf8c067d1 100644
> --- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
> +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
> @@ -938,7 +938,7 @@ int jh7110_pinctrl_probe(struct platform_device *pdev)
> sfp->gc.set = jh7110_gpio_set;
> sfp->gc.set_config = jh7110_gpio_set_config;
> sfp->gc.add_pin_ranges = jh7110_gpio_add_pin_ranges;
> - sfp->gc.base = info->gc_base;
> + sfp->gc.base = -1;
> sfp->gc.ngpio = info->ngpios;
>
> jh7110_irq_chip.name = sfp->gc.label;
> --
> 2.43.0
>
>
That's a NACK until you also remove JH7110_AON_GC_BASE and
JH7110_SYS_GC_BASE assignments after explaining why they are no longer
needed.
Bartosz
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] pinctrl: starfive: use dynamic GPIO base allocation
2025-10-22 7:23 ` Bartosz Golaszewski
@ 2025-10-23 12:18 ` Emil Renner Berthing
2025-10-24 14:33 ` [PATCH v2] " Ali Tariq
0 siblings, 1 reply; 6+ messages in thread
From: Emil Renner Berthing @ 2025-10-23 12:18 UTC (permalink / raw)
To: Ali Tariq, Hal Feng, Bartosz Golaszewski
Cc: Linus Walleij, linux-gpio, linux-kernel
Hi Ali,
Quoting Bartosz Golaszewski (2025-10-22 09:23:37)
> On Tue, Oct 21, 2025 at 8:17 PM Ali Tariq <alitariq45892@gmail.com> wrote:
> >
> > The JH7110 pinctrl driver currently sets a static GPIO base number from
> > platform data:
> >
> > sfp->gc.base = info->gc_base;
> >
> > Static base assignment is deprecated and results in the following warning:
> >
> > gpio gpiochip0: Static allocation of GPIO base is deprecated,
> > use dynamic allocation.
> >
> > Set `sfp->gc.base = -1` to let the GPIO core dynamically allocate
> > the base number. This removes the warning and aligns the driver
> > with current GPIO guidelines.
> >
> > Tested on VisionFive 2 (JH7110 SoC).
> >
> > Signed-off-by: Ali Tariq <alitariq45892@gmail.com>
> > ---
> > drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
> > index 05e3af75b09f..eb5cf8c067d1 100644
> > --- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
> > +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
> > @@ -938,7 +938,7 @@ int jh7110_pinctrl_probe(struct platform_device *pdev)
> > sfp->gc.set = jh7110_gpio_set;
> > sfp->gc.set_config = jh7110_gpio_set_config;
> > sfp->gc.add_pin_ranges = jh7110_gpio_add_pin_ranges;
> > - sfp->gc.base = info->gc_base;
> > + sfp->gc.base = -1;
> > sfp->gc.ngpio = info->ngpios;
> >
> > jh7110_irq_chip.name = sfp->gc.label;
> > --
> > 2.43.0
> >
> >
>
> That's a NACK until you also remove JH7110_AON_GC_BASE and
> JH7110_SYS_GC_BASE assignments after explaining why they are no longer
> needed.
Thanks for your patch, cleaning this up. As Bartosz said you'd want to clean up
the now unused defines and the gc_base member of struct jh7110_pinctrl_soc_info
too though.
As for why this is no longer needed, I don't think it was ever needed. It just
slipped through review unfortunately. Hal should be able to explain why if
that's not the case.
/Emil
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] pinctrl: starfive: use dynamic GPIO base allocation
2025-10-23 12:18 ` Emil Renner Berthing
@ 2025-10-24 14:33 ` Ali Tariq
2025-10-25 10:52 ` Emil Renner Berthing
0 siblings, 1 reply; 6+ messages in thread
From: Ali Tariq @ 2025-10-24 14:33 UTC (permalink / raw)
To: kernel
Cc: alitariq45892, brgl, hal.feng, linus.walleij, linux-gpio, linux-kernel
The JH7110 pinctrl driver currently sets a static GPIO base number from
platform data:
sfp->gc.base = info->gc_base;
Static base assignment is deprecated and results in the following warning:
gpio gpiochip0: Static allocation of GPIO base is deprecated,
use dynamic allocation.
Set `sfp->gc.base = -1` to let the GPIO core dynamically allocate
the base number. This removes the warning and aligns the driver
with current GPIO guidelines.
Tested on VisionFive 2 (JH7110 SoC).
Signed-off-by: Ali Tariq <alitariq45892@gmail.com>
---
Changes in v2
- Remove unused gc_base field from struct jh7110_pinctrl_soc_info
- Drop unused JH7110_SYS_GC_BASE and JH7110_AON_GC_BASE defines
- Remove .gc_base assignments from jh7110_sys_pinctrl_info and jh7110_aon_pinctrl_info
- No functional change otherwise
---
drivers/pinctrl/starfive/pinctrl-starfive-jh7110-aon.c | 2 --
drivers/pinctrl/starfive/pinctrl-starfive-jh7110-sys.c | 2 --
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 2 +-
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.h | 1 -
4 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110-aon.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110-aon.c
index cf42e204cbf0..3433b3c91692 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110-aon.c
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110-aon.c
@@ -29,7 +29,6 @@
#include "pinctrl-starfive-jh7110.h"
#define JH7110_AON_NGPIO 4
-#define JH7110_AON_GC_BASE 64
#define JH7110_AON_REGS_NUM 37
@@ -138,7 +137,6 @@ static const struct jh7110_pinctrl_soc_info jh7110_aon_pinctrl_info = {
.pins = jh7110_aon_pins,
.npins = ARRAY_SIZE(jh7110_aon_pins),
.ngpios = JH7110_AON_NGPIO,
- .gc_base = JH7110_AON_GC_BASE,
.dout_reg_base = JH7110_AON_DOUT,
.dout_mask = GENMASK(3, 0),
.doen_reg_base = JH7110_AON_DOEN,
diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110-sys.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110-sys.c
index 03c2ad808d61..9b67063a0b0b 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110-sys.c
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110-sys.c
@@ -29,7 +29,6 @@
#include "pinctrl-starfive-jh7110.h"
#define JH7110_SYS_NGPIO 64
-#define JH7110_SYS_GC_BASE 0
#define JH7110_SYS_REGS_NUM 174
@@ -410,7 +409,6 @@ static const struct jh7110_pinctrl_soc_info jh7110_sys_pinctrl_info = {
.pins = jh7110_sys_pins,
.npins = ARRAY_SIZE(jh7110_sys_pins),
.ngpios = JH7110_SYS_NGPIO,
- .gc_base = JH7110_SYS_GC_BASE,
.dout_reg_base = JH7110_SYS_DOUT,
.dout_mask = GENMASK(6, 0),
.doen_reg_base = JH7110_SYS_DOEN,
diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
index 05e3af75b09f..eb5cf8c067d1 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
@@ -938,7 +938,7 @@ int jh7110_pinctrl_probe(struct platform_device *pdev)
sfp->gc.set = jh7110_gpio_set;
sfp->gc.set_config = jh7110_gpio_set_config;
sfp->gc.add_pin_ranges = jh7110_gpio_add_pin_ranges;
- sfp->gc.base = info->gc_base;
+ sfp->gc.base = -1;
sfp->gc.ngpio = info->ngpios;
jh7110_irq_chip.name = sfp->gc.label;
diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.h b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.h
index a33d0d4e1382..2da2d6858008 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.h
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.h
@@ -38,7 +38,6 @@ struct jh7110_pinctrl_soc_info {
const struct pinctrl_pin_desc *pins;
unsigned int npins;
unsigned int ngpios;
- unsigned int gc_base;
/* gpio dout/doen/din/gpioinput register */
unsigned int dout_reg_base;
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] pinctrl: starfive: use dynamic GPIO base allocation
2025-10-24 14:33 ` [PATCH v2] " Ali Tariq
@ 2025-10-25 10:52 ` Emil Renner Berthing
2025-10-25 21:29 ` Ali Tariq
0 siblings, 1 reply; 6+ messages in thread
From: Emil Renner Berthing @ 2025-10-25 10:52 UTC (permalink / raw)
To: Ali Tariq
Cc: hal.feng, linus.walleij, linux-gpio, linux-kernel, Bartosz Golaszewski
Quoting Ali Tariq (2025-10-24 16:33:53)
> The JH7110 pinctrl driver currently sets a static GPIO base number from
> platform data:
>
> sfp->gc.base = info->gc_base;
>
> Static base assignment is deprecated and results in the following warning:
>
> gpio gpiochip0: Static allocation of GPIO base is deprecated,
> use dynamic allocation.
>
> Set `sfp->gc.base = -1` to let the GPIO core dynamically allocate
> the base number. This removes the warning and aligns the driver
> with current GPIO guidelines.
>
> Tested on VisionFive 2 (JH7110 SoC).
>
> Signed-off-by: Ali Tariq <alitariq45892@gmail.com>
> ---
> Changes in v2
> - Remove unused gc_base field from struct jh7110_pinctrl_soc_info
> - Drop unused JH7110_SYS_GC_BASE and JH7110_AON_GC_BASE defines
> - Remove .gc_base assignments from jh7110_sys_pinctrl_info and jh7110_aon_pinctrl_info
> - No functional change otherwise
Hi Ali,
Thanks for the detailed log of changes since v1. Just 2 comments:
1) The justification for why this is no longer needed should be in the commit
message, and not just in a random thread that will soon be forgotten.
2) Please don't send new revisions as replies. Start a new mail thread.
The code changes look good though, so once that is fixed you can add
Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
/Emil
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] pinctrl: starfive: use dynamic GPIO base allocation
2025-10-25 10:52 ` Emil Renner Berthing
@ 2025-10-25 21:29 ` Ali Tariq
0 siblings, 0 replies; 6+ messages in thread
From: Ali Tariq @ 2025-10-25 21:29 UTC (permalink / raw)
To: Emil Renner Berthing
Cc: hal.feng, linus.walleij, linux-gpio, linux-kernel, Bartosz Golaszewski
Hi Emil,
Thanks for the review and feedback.
Quoting Emil Renner Berthing:
> 1) The justification for why this is no longer needed should be in
the commit
> message, and not just in a random thread that will soon be forgotten.
My apologies for the confusion. I did add the removal of unused
variables as a bullet point in the v2 changelog (which is in the email
body), but I failed to include the necessary justification for this
removal in the main commit message itself.
You are correct, the justification for removing `gc_base` and associated
macros (because we now use `sfp->gc.base = -1` for dynamic allocation)
belongs in the permanent commit message.
I will update the v2 commit message to clearly state the removal of
macros and unused definitions (before "Signed-off-by") in the v3 submission.
Quoting Emil Renner Berthing:
> 2) Please don't send new revisions as replies. Start a new mail thread.
Understood. I will send the next revision as a new thread.
Quoting Emil Renner Berthing:
> The code changes look good though, so once that is fixed you can add
>
> Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Understood. I will include your Reviewed-by tag in the v3 patch.
Thanks again for the review!
-Ali
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-10-25 21:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-21 18:16 [PATCH] pinctrl: starfive: use dynamic GPIO base allocation Ali Tariq
2025-10-22 7:23 ` Bartosz Golaszewski
2025-10-23 12:18 ` Emil Renner Berthing
2025-10-24 14:33 ` [PATCH v2] " Ali Tariq
2025-10-25 10:52 ` Emil Renner Berthing
2025-10-25 21:29 ` Ali Tariq
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®