[PATCH v1 3/8] gpiolib: Warn on drivers still using static gpiobase allocation

Christophe Leroy posted 8 patches 3 years, 7 months ago
[PATCH v1 3/8] gpiolib: Warn on drivers still using static gpiobase allocation
Posted by Christophe Leroy 3 years, 7 months ago
In the preparation of getting completely rid of static gpiobase
allocation in the future, emit a warning in drivers still doing so.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 drivers/gpio/gpiolib.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index cc9c0a12259e..3a6f29eeb72d 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -715,6 +715,9 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
 		 * a poison instead.
 		 */
 		gc->base = base;
+	} else {
+		dev_warn(&gdev->dev, "Static allocation of GPIO base is "
+				     "deprecated, use dynamic allocation.");
 	}
 	gdev->base = base;
 
-- 
2.37.1
Re: [PATCH v1 3/8] gpiolib: Warn on drivers still using static gpiobase allocation
Posted by Andy Shevchenko 3 years, 7 months ago
On Mon, Aug 29, 2022 at 7:18 PM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
>
> In the preparation of getting completely rid of static gpiobase
> allocation in the future, emit a warning in drivers still doing so.

...

> +               dev_warn(&gdev->dev, "Static allocation of GPIO base is "
> +                                    "deprecated, use dynamic allocation.");

First of all, do not split string literals. Second, you forgot '\n'.

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v1 3/8] gpiolib: Warn on drivers still using static gpiobase allocation
Posted by Christophe Leroy 3 years, 7 months ago

Le 30/08/2022 à 22:14, Andy Shevchenko a écrit :
> On Mon, Aug 29, 2022 at 7:18 PM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
>>
>> In the preparation of getting completely rid of static gpiobase
>> allocation in the future, emit a warning in drivers still doing so.
> 
> ...
> 
>> +               dev_warn(&gdev->dev, "Static allocation of GPIO base is "
>> +                                    "deprecated, use dynamic allocation.");
> 
> First of all, do not split string literals. Second, you forgot '\n'.
> 

Then I get a line longer than 100 chars, is that acceptable ?

Since commit 5fd29d6ccbc9 ("printk: clean up handling of log-levels and 
newlines"), "\n" are just visual pollution, aren't they ?

Christophe
Re: [PATCH v1 3/8] gpiolib: Warn on drivers still using static gpiobase allocation
Posted by Geert Uytterhoeven 3 years, 7 months ago
Hi Christophe,

On Wed, Aug 31, 2022 at 7:39 AM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
> Le 30/08/2022 à 22:14, Andy Shevchenko a écrit :
> > On Mon, Aug 29, 2022 at 7:18 PM Christophe Leroy
> > <christophe.leroy@csgroup.eu> wrote:
> >> In the preparation of getting completely rid of static gpiobase
> >> allocation in the future, emit a warning in drivers still doing so.
> >
> > ...
> >
> >> +               dev_warn(&gdev->dev, "Static allocation of GPIO base is "
> >> +                                    "deprecated, use dynamic allocation.");
> >
> > First of all, do not split string literals. Second, you forgot '\n'.
>
> Then I get a line longer than 100 chars, is that acceptable ?

Yes it is.  It is a much worse user experience if

    git grep "Static allocation of GPIO base is deprecated"

does not let you find the line that does fit in 100 chars ;-)

> Since commit 5fd29d6ccbc9 ("printk: clean up handling of log-levels and
> newlines"), "\n" are just visual pollution, aren't they ?

The convention is to always add it.  See also commit a0cba2179ea4c182
("Revert "printk: create pr_<level> functions"").

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds