gpio: mxs: use dynamic allocation of base
Subsystems (2)
PATCH 1/1 gpio: mxs: use dynamic allocation of base
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.
---
drivers/gpio/gpio-mxs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-mxs.c +1 -1
@@ -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)
Signature · 1 line
2.32.0
Hi Dario,
Am 26.02.23 um 21:53 schrieb Dario Binacchi:
Quoted 11 lines
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
Quoted 20 lines
Signed-off-by Dario Binacchi <[email protected]>---
drivers/gpio/gpio-mxs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-mxs.c +1
-1@@ -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)
Hi Stefan,
Quoted 16 lines · Stefan Wahren
Hi Dario,
Am 26.02.23 um 21:53 schrieb Dario Binacchi:
Quoted 11 lines
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.
Quoted 7 lines
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
Quoted 23 lines
Best regards
Quoted 20 lines
Signed-off-by Dario Binacchi <[email protected]>---
drivers/gpio/gpio-mxs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-mxs.c +1
-1@@ -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)
Signature · 17 lines
Dario Binacchi Senior Embedded Linux Developer [email protected] __________________________________ Amarula Solutions SRL Via Le Canevare 30, 31100 Treviso, Veneto, IT T. +39 042 243 5310 [email protected] www.amarulasolutions.com
Hi Dario,
Quoted 21 lines · Dario Binacchi
Hi Stefan,
Quoted 18 lines · Stefan Wahren
Hi Dario,
Am 26.02.23 um 21:53 schrieb Dario Binacchi:
Quoted 11 lines
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.
Quoted 7 lines
Quoted 5 lines
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/[email protected]/
Quoted 2 lines
Do you think it makes sense to use a
Kconfigoption 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
Quoted 24 lines
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,
DarioQuoted 16 lines
Best regards
Quoted 13 lines
Signed-off-by Dario Binacchi <[email protected]>---
drivers/gpio/gpio-mxs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-mxs.c +0
-0@@ -330,7 +330,7 @@ static int mxs_gpio_probe(struct platform_device *pdev)
Quoted 31 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpio/gpio-mxs.c +1
-1port->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)Signature · 17 lines
Dario Binacchi Senior Embedded Linux Developer [email protected] __________________________________ Amarula Solutions SRL Via Le Canevare 30, 31100 Treviso, Veneto, IT T. +39 042 243 5310 [email protected] www.amarulasolutions.com
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi everyone,
Am Dienstag, 28. Februar 2023, 09:46:27 CET schrieb Marco Felsch:
Quoted 6 lines
Hi Dario,
Quoted 3 lines · Dario Binacchi
Hi Stefan,
On Mon, Feb 27, 2023 at 6:52 PM Stefan Wahren <[email protected]>
Quoted 33 lines · wrote:
Quoted 21 lines
Quoted 21 lines
Hi Dario,
Am 26.02.23 um 21:53 schrieb Dario Binacchi:
Quoted 12 lines
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 isQuoted 3 lines
deprecated, use dynamic allocation.
So let's follow the suggestion and use dynamic allocation.
i understand the motivation of avoiding these warnings.
Quoted 7 lines
Quoted 5 lines
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:
Quoted 7 lines
Quoted 2 lines
Do you think it makes sense to use a
Kconfigoption to enable/disable the dynamic allocation of GPIO base?What we could do is to check the
GPIO_SYSFSkconfig 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 newKconfigsymbol.
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/[email protected]/T/#u
[2] https://lore.kernel.org/linux-gpio/5941337.lOV4Wx5bFT@steina-w/T/
#m2a74777fc4031b7f6f30ac1dcf65b20e7d3f8f12
Quoted 34 lines
Regards,
MarcoQuoted 31 lines
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,
DarioQuoted 23 lines
Best regards
Quoted 21 lines
Signed-off-by Dario Binacchi <[email protected]>---
drivers/gpio/gpio-mxs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-mxs.c +1
-1@@ -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)
Signature · 4 lines
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/