linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: mxc: use dynamic allocation of base
@ 2023-02-26 20:53 Dario Binacchi
  2023-03-06 10:03 ` Bartosz Golaszewski
  0 siblings, 1 reply; 4+ messages in thread
From: Dario Binacchi @ 2023-02-26 20:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dario Binacchi, Bartosz Golaszewski, Linus Walleij, 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:

[    1.611480] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.622893] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.633272] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.643388] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.653474] 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-mxc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 9d0cec4b82a3..abc129a88a62 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -462,8 +462,7 @@ static int mxc_gpio_probe(struct platform_device *pdev)
 	port->gc.request = gpiochip_generic_request;
 	port->gc.free = gpiochip_generic_free;
 	port->gc.to_irq = mxc_gpio_to_irq;
-	port->gc.base = (pdev->id < 0) ? of_alias_get_id(np, "gpio") * 32 :
-					     pdev->id * 32;
+	port->gc.base = -1;
 
 	err = devm_gpiochip_add_data(&pdev->dev, &port->gc, port);
 	if (err)
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: mxc: use dynamic allocation of base
  2023-02-26 20:53 [PATCH] gpio: mxc: use dynamic allocation of base Dario Binacchi
@ 2023-03-06 10:03 ` Bartosz Golaszewski
  2023-03-06 23:07   ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Bartosz Golaszewski @ 2023-03-06 10:03 UTC (permalink / raw)
  To: Dario Binacchi, Linus Walleij; +Cc: linux-kernel, linux-gpio

On Sun, Feb 26, 2023 at 9:53 PM Dario Binacchi
<dario.binacchi@amarulasolutions.com> wrote:
>
> 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:
>
> [    1.611480] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
> [    1.622893] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
> [    1.633272] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation.
> [    1.643388] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation.
> [    1.653474] 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-mxc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index 9d0cec4b82a3..abc129a88a62 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
> @@ -462,8 +462,7 @@ static int mxc_gpio_probe(struct platform_device *pdev)
>         port->gc.request = gpiochip_generic_request;
>         port->gc.free = gpiochip_generic_free;
>         port->gc.to_irq = mxc_gpio_to_irq;
> -       port->gc.base = (pdev->id < 0) ? of_alias_get_id(np, "gpio") * 32 :
> -                                            pdev->id * 32;
> +       port->gc.base = -1;
>
>         err = devm_gpiochip_add_data(&pdev->dev, &port->gc, port);
>         if (err)
> --
> 2.32.0
>

Linus,

I'm afraid we'll need to do something about this warning, because
we're getting the same patch for like 4th time already...

Bart

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: mxc: use dynamic allocation of base
  2023-03-06 10:03 ` Bartosz Golaszewski
@ 2023-03-06 23:07   ` Linus Walleij
  2023-03-13 22:43     ` Christophe Leroy
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2023-03-06 23:07 UTC (permalink / raw)
  To: Bartosz Golaszewski, Christophe Leroy
  Cc: Dario Binacchi, linux-kernel, linux-gpio

On Mon, Mar 6, 2023 at 11:03 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> On Sun, Feb 26, 2023 at 9:53 PM Dario Binacchi
> <dario.binacchi@amarulasolutions.com> wrote:
> >
> > 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:
> >
> > [    1.611480] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
> > [    1.622893] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
> > [    1.633272] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation.
> > [    1.643388] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation.
> > [    1.653474] gpio gpiochip4: Static allocation of GPIO base is deprecated, use dynamic allocation.
(...)
> Linus,
>
> I'm afraid we'll need to do something about this warning, because
> we're getting the same patch for like 4th time already...

OK what about reverting
commit 502df79b860563d79143be7a1453c2b3224cd836
"gpiolib: Warn on drivers still using static gpiobase allocation"

Until we have less drivers with static allocations?

In a way it is good that it is fixed, but it's not good if you get
snowed under by patches and discussions about this.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: mxc: use dynamic allocation of base
  2023-03-06 23:07   ` Linus Walleij
@ 2023-03-13 22:43     ` Christophe Leroy
  0 siblings, 0 replies; 4+ messages in thread
From: Christophe Leroy @ 2023-03-13 22:43 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Arnd Bergmann
  Cc: Dario Binacchi, linux-kernel, linux-gpio



Le 07/03/2023 à 00:07, Linus Walleij a écrit :
> On Mon, Mar 6, 2023 at 11:03 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>> On Sun, Feb 26, 2023 at 9:53 PM Dario Binacchi
>> <dario.binacchi@amarulasolutions.com> wrote:
>>>
>>> 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:
>>>
>>> [    1.611480] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
>>> [    1.622893] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
>>> [    1.633272] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation.
>>> [    1.643388] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation.
>>> [    1.653474] gpio gpiochip4: Static allocation of GPIO base is deprecated, use dynamic allocation.
> (...)
>> Linus,
>>
>> I'm afraid we'll need to do something about this warning, because
>> we're getting the same patch for like 4th time already...
> 
> OK what about reverting
> commit 502df79b860563d79143be7a1453c2b3224cd836
> "gpiolib: Warn on drivers still using static gpiobase allocation"
> 
> Until we have less drivers with static allocations?
> 
> In a way it is good that it is fixed, but it's not good if you get
> snowed under by patches and discussions about this.
> 

Well, I have no strong opinion about that, as far as I remember that's 
more discussion with Arnd that made me think it was the way to go.

The Documentation has been saying since 2015 that the sysfs ABI is 
obsoleted and will be removed after 2020. So are static allocations 
required at all still ?

By the way, there are several other places in the kernel that have had 
such warnings for years without making any problem, at least that 
reminds people that something needs to be done.

Christophe

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-13 22:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-26 20:53 [PATCH] gpio: mxc: use dynamic allocation of base Dario Binacchi
2023-03-06 10:03 ` Bartosz Golaszewski
2023-03-06 23:07   ` Linus Walleij
2023-03-13 22:43     ` Christophe Leroy

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