* [PATCH] gpio: mxs: use dynamic allocation of base
@ 2023-02-26 20:53 Dario Binacchi
2023-02-27 17:52 ` Stefan Wahren
0 siblings, 1 reply; 5+ messages in thread
From: Dario Binacchi @ 2023-02-26 20:53 UTC (permalink / raw)
To: linux-kernel
Cc: Dario Binacchi, Bartosz Golaszewski, Fabio Estevam, Linus Walleij,
NXP Linux Team, Pengutronix Kernel Team, Sascha Hauer, Shawn Guo,
linux-arm-kernel, linux-gpio
Since commit 502df79b860563d7 ("gpiolib: Warn on drivers still using static
gpiobase allocation"), one or more warnings are printed during boot on
systems where static allocation of GPIO base is used:
[ 0.136834] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[ 0.142753] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
[ 0.148452] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation.
[ 0.154341] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation.
[ 0.160097] gpio gpiochip4: Static allocation of GPIO base is deprecated, use dynamic allocation.
So let's follow the suggestion and use dynamic allocation.
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
drivers/gpio/gpio-mxs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
index 7f59e5d936c2..b48a7c1fb7c1 100644
--- a/drivers/gpio/gpio-mxs.c
+++ b/drivers/gpio/gpio-mxs.c
@@ -330,7 +330,7 @@ static int mxs_gpio_probe(struct platform_device *pdev)
port->gc.to_irq = mxs_gpio_to_irq;
port->gc.get_direction = mxs_gpio_get_direction;
- port->gc.base = port->id * 32;
+ port->gc.base = -1;
err = gpiochip_add_data(&port->gc, port);
if (err)
--
2.32.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: mxs: use dynamic allocation of base
2023-02-26 20:53 [PATCH] gpio: mxs: use dynamic allocation of base Dario Binacchi
@ 2023-02-27 17:52 ` Stefan Wahren
2023-02-28 7:50 ` Dario Binacchi
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Wahren @ 2023-02-27 17:52 UTC (permalink / raw)
To: Dario Binacchi, linux-kernel
Cc: Bartosz Golaszewski, Fabio Estevam, Linus Walleij, NXP Linux Team,
Pengutronix Kernel Team, Sascha Hauer, Shawn Guo,
linux-arm-kernel, linux-gpio
Hi Dario,
Am 26.02.23 um 21:53 schrieb Dario Binacchi:
> Since commit 502df79b860563d7 ("gpiolib: Warn on drivers still using static
> gpiobase allocation"), one or more warnings are printed during boot on
> systems where static allocation of GPIO base is used:
>
> [ 0.136834] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
> [ 0.142753] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
> [ 0.148452] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation.
> [ 0.154341] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation.
> [ 0.160097] gpio gpiochip4: Static allocation of GPIO base is deprecated, use dynamic allocation.
>
> So let's follow the suggestion and use dynamic allocation.
i understand the motivation of avoiding these warnings.
AFAIK the MXS platform is older than the dynamic allocation of GPIO
base. In the perfect world all applications has been migrated to
libgpiod / chardev GPIO. But i'm really concerned this hasn't happend
yet, at least for this platform. So i believe this change break
applications, since it affects userspace.
Best regards
>
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> ---
>
> drivers/gpio/gpio-mxs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
> index 7f59e5d936c2..b48a7c1fb7c1 100644
> --- a/drivers/gpio/gpio-mxs.c
> +++ b/drivers/gpio/gpio-mxs.c
> @@ -330,7 +330,7 @@ static int mxs_gpio_probe(struct platform_device *pdev)
>
> port->gc.to_irq = mxs_gpio_to_irq;
> port->gc.get_direction = mxs_gpio_get_direction;
> - port->gc.base = port->id * 32;
> + port->gc.base = -1;
>
> err = gpiochip_add_data(&port->gc, port);
> if (err)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: mxs: use dynamic allocation of base
2023-02-27 17:52 ` Stefan Wahren
@ 2023-02-28 7:50 ` Dario Binacchi
2023-02-28 8:46 ` Marco Felsch
0 siblings, 1 reply; 5+ messages in thread
From: Dario Binacchi @ 2023-02-28 7:50 UTC (permalink / raw)
To: Stefan Wahren
Cc: linux-kernel, Bartosz Golaszewski, Fabio Estevam, Linus Walleij,
NXP Linux Team, Pengutronix Kernel Team, Sascha Hauer, Shawn Guo,
linux-arm-kernel, linux-gpio
Hi Stefan,
On Mon, Feb 27, 2023 at 6:52 PM Stefan Wahren <stefan.wahren@i2se.com> wrote:
>
> Hi Dario,
>
> Am 26.02.23 um 21:53 schrieb Dario Binacchi:
> > Since commit 502df79b860563d7 ("gpiolib: Warn on drivers still using static
> > gpiobase allocation"), one or more warnings are printed during boot on
> > systems where static allocation of GPIO base is used:
> >
> > [ 0.136834] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
> > [ 0.142753] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
> > [ 0.148452] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation.
> > [ 0.154341] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation.
> > [ 0.160097] gpio gpiochip4: Static allocation of GPIO base is deprecated, use dynamic allocation.
> >
> > So let's follow the suggestion and use dynamic allocation.
>
> i understand the motivation of avoiding these warnings.
>
> AFAIK the MXS platform is older than the dynamic allocation of GPIO
> base. In the perfect world all applications has been migrated to
> libgpiod / chardev GPIO. But i'm really concerned this hasn't happend
> yet, at least for this platform. So i believe this change break
> applications, since it affects userspace.
Thanks for your explanations.
Do you think it makes sense to use a Kconfig option to enable/disable
the dynamic allocation of GPIO base?
As done, if I'm not mistaken, in commit 80d34260f36c6 ("pinctrl:
renesas: gpio: Use dynamic GPIO base if no function GPIOs")?
With legacy support enabled by default, but the ability to try out the
latest dynamic allocation functionality.
Thanks and regards,
Dario
>
> Best regards
>
> >
> > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> > ---
> >
> > drivers/gpio/gpio-mxs.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
> > index 7f59e5d936c2..b48a7c1fb7c1 100644
> > --- a/drivers/gpio/gpio-mxs.c
> > +++ b/drivers/gpio/gpio-mxs.c
> > @@ -330,7 +330,7 @@ static int mxs_gpio_probe(struct platform_device *pdev)
> >
> > port->gc.to_irq = mxs_gpio_to_irq;
> > port->gc.get_direction = mxs_gpio_get_direction;
> > - port->gc.base = port->id * 32;
> > + port->gc.base = -1;
> >
> > err = gpiochip_add_data(&port->gc, port);
> > if (err)
--
Dario Binacchi
Senior Embedded Linux Developer
dario.binacchi@amarulasolutions.com
__________________________________
Amarula Solutions SRL
Via Le Canevare 30, 31100 Treviso, Veneto, IT
T. +39 042 243 5310
info@amarulasolutions.com
www.amarulasolutions.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: mxs: use dynamic allocation of base
2023-02-28 7:50 ` Dario Binacchi
@ 2023-02-28 8:46 ` Marco Felsch
2023-02-28 9:06 ` Alexander Stein
0 siblings, 1 reply; 5+ messages in thread
From: Marco Felsch @ 2023-02-28 8:46 UTC (permalink / raw)
To: Dario Binacchi
Cc: Stefan Wahren, Sascha Hauer, Shawn Guo, Bartosz Golaszewski,
linux-kernel, linux-gpio, NXP Linux Team, Pengutronix Kernel Team,
Fabio Estevam, Linus Walleij, linux-arm-kernel
Hi Dario,
On 23-02-28, Dario Binacchi wrote:
> Hi Stefan,
>
> On Mon, Feb 27, 2023 at 6:52 PM Stefan Wahren <stefan.wahren@i2se.com> wrote:
> >
> > Hi Dario,
> >
> > Am 26.02.23 um 21:53 schrieb Dario Binacchi:
> > > Since commit 502df79b860563d7 ("gpiolib: Warn on drivers still using static
> > > gpiobase allocation"), one or more warnings are printed during boot on
> > > systems where static allocation of GPIO base is used:
> > >
> > > [ 0.136834] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
> > > [ 0.142753] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
> > > [ 0.148452] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation.
> > > [ 0.154341] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation.
> > > [ 0.160097] gpio gpiochip4: Static allocation of GPIO base is deprecated, use dynamic allocation.
> > >
> > > So let's follow the suggestion and use dynamic allocation.
> >
> > i understand the motivation of avoiding these warnings.
> >
> > AFAIK the MXS platform is older than the dynamic allocation of GPIO
> > base. In the perfect world all applications has been migrated to
> > libgpiod / chardev GPIO. But i'm really concerned this hasn't happend
> > yet, at least for this platform. So i believe this change break
> > applications, since it affects userspace.
>
> Thanks for your explanations.
There was also a lengthly discussion here:
https://lore.kernel.org/all/20230120104647.nwki4silrtd7bt3w@pengutronix.de/
> Do you think it makes sense to use a Kconfig option to enable/disable
> the dynamic allocation of GPIO base?
What we could do is to check the GPIO_SYSFS kconfig symbol. If this is
enabled we should keep the current behaviour to not break the uAPI else
we can go with the dynamic numbering. What we should avoid is a new
Kconfig symbol.
Regards,
Marco
> As done, if I'm not mistaken, in commit 80d34260f36c6 ("pinctrl:
> renesas: gpio: Use dynamic GPIO base if no function GPIOs")?
> With legacy support enabled by default, but the ability to try out the
> latest dynamic allocation functionality.
>
> Thanks and regards,
> Dario
>
> >
> > Best regards
> >
> > >
> > > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> > > ---
> > >
> > > drivers/gpio/gpio-mxs.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
> > > index 7f59e5d936c2..b48a7c1fb7c1 100644
> > > --- a/drivers/gpio/gpio-mxs.c
> > > +++ b/drivers/gpio/gpio-mxs.c
> > > @@ -330,7 +330,7 @@ static int mxs_gpio_probe(struct platform_device *pdev)
> > >
> > > port->gc.to_irq = mxs_gpio_to_irq;
> > > port->gc.get_direction = mxs_gpio_get_direction;
> > > - port->gc.base = port->id * 32;
> > > + port->gc.base = -1;
> > >
> > > err = gpiochip_add_data(&port->gc, port);
> > > if (err)
>
>
>
> --
>
> Dario Binacchi
>
> Senior Embedded Linux Developer
>
> dario.binacchi@amarulasolutions.com
>
> __________________________________
>
>
> Amarula Solutions SRL
>
> Via Le Canevare 30, 31100 Treviso, Veneto, IT
>
> T. +39 042 243 5310
> info@amarulasolutions.com
>
> www.amarulasolutions.com
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: mxs: use dynamic allocation of base
2023-02-28 8:46 ` Marco Felsch
@ 2023-02-28 9:06 ` Alexander Stein
0 siblings, 0 replies; 5+ messages in thread
From: Alexander Stein @ 2023-02-28 9:06 UTC (permalink / raw)
To: Dario Binacchi, Marco Felsch
Cc: Stefan Wahren, Sascha Hauer, Shawn Guo, Bartosz Golaszewski,
linux-kernel, linux-gpio, NXP Linux Team, Pengutronix Kernel Team,
Fabio Estevam, Linus Walleij, linux-arm-kernel
Hi everyone,
Am Dienstag, 28. Februar 2023, 09:46:27 CET schrieb Marco Felsch:
> Hi Dario,
>
> On 23-02-28, Dario Binacchi wrote:
> > Hi Stefan,
> >
> > On Mon, Feb 27, 2023 at 6:52 PM Stefan Wahren <stefan.wahren@i2se.com>
wrote:
> > > Hi Dario,
> > >
> > > Am 26.02.23 um 21:53 schrieb Dario Binacchi:
> > > > Since commit 502df79b860563d7 ("gpiolib: Warn on drivers still using
> > > > static
> > > > gpiobase allocation"), one or more warnings are printed during boot on
> > > > systems where static allocation of GPIO base is used:
> > > >
> > > > [ 0.136834] gpio gpiochip0: Static allocation of GPIO base is
> > > > deprecated, use dynamic allocation. [ 0.142753] gpio gpiochip1:
> > > > Static allocation of GPIO base is deprecated, use dynamic allocation.
> > > > [ 0.148452] gpio gpiochip2: Static allocation of GPIO base is
> > > > deprecated, use dynamic allocation. [ 0.154341] gpio gpiochip3:
> > > > Static allocation of GPIO base is deprecated, use dynamic allocation.
> > > > [ 0.160097] gpio gpiochip4: Static allocation of GPIO base is
> > > > deprecated, use dynamic allocation.
> > > >
> > > > So let's follow the suggestion and use dynamic allocation.
> > >
> > > i understand the motivation of avoiding these warnings.
> > >
> > > AFAIK the MXS platform is older than the dynamic allocation of GPIO
> > > base. In the perfect world all applications has been migrated to
> > > libgpiod / chardev GPIO. But i'm really concerned this hasn't happend
> > > yet, at least for this platform. So i believe this change break
> > > applications, since it affects userspace.
> >
> > Thanks for your explanations.
>
> There was also a lengthly discussion here:
>
> https://lore.kernel.org/all/20230120104647.nwki4silrtd7bt3w@pengutronix.de/
>
> > Do you think it makes sense to use a Kconfig option to enable/disable
> > the dynamic allocation of GPIO base?
>
> What we could do is to check the GPIO_SYSFS kconfig symbol. If this is
> enabled we should keep the current behaviour to not break the uAPI else
> we can go with the dynamic numbering. What we should avoid is a new
> Kconfig symbol.
Even that is only half of the truth. Apparently this is crucial for
GPIO_SYSFS, but even without sysfs it affects the order of the character
devices, which might break userspace. The main open issue is, whether GPIO
aliases shall be supported or not, see see [1] and [2].
Once this is clear, the switch to dynamic base can be done.
Best regards,
Alexander
[1] https://lore.kernel.org/linux-gpio/20230215092421.143199-1-alexander.stein@ew.tq-group.com/T/#u
[2] https://lore.kernel.org/linux-gpio/5941337.lOV4Wx5bFT@steina-w/T/
#m2a74777fc4031b7f6f30ac1dcf65b20e7d3f8f12
> Regards,
> Marco
>
> > As done, if I'm not mistaken, in commit 80d34260f36c6 ("pinctrl:
> > renesas: gpio: Use dynamic GPIO base if no function GPIOs")?
> > With legacy support enabled by default, but the ability to try out the
> > latest dynamic allocation functionality.
> >
> > Thanks and regards,
> > Dario
> >
> > > Best regards
> > >
> > > > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> > > > ---
> > > >
> > > > drivers/gpio/gpio-mxs.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
> > > > index 7f59e5d936c2..b48a7c1fb7c1 100644
> > > > --- a/drivers/gpio/gpio-mxs.c
> > > > +++ b/drivers/gpio/gpio-mxs.c
> > > > @@ -330,7 +330,7 @@ static int mxs_gpio_probe(struct platform_device
> > > > *pdev)
> > > >
> > > > port->gc.to_irq = mxs_gpio_to_irq;
> > > > port->gc.get_direction = mxs_gpio_get_direction;
> > > >
> > > > - port->gc.base = port->id * 32;
> > > > + port->gc.base = -1;
> > > >
> > > > err = gpiochip_add_data(&port->gc, port);
> > > > if (err)
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-02-28 9:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-26 20:53 [PATCH] gpio: mxs: use dynamic allocation of base Dario Binacchi
2023-02-27 17:52 ` Stefan Wahren
2023-02-28 7:50 ` Dario Binacchi
2023-02-28 8:46 ` Marco Felsch
2023-02-28 9:06 ` Alexander Stein
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).