All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 6/8] gpiolib: remove legacy gpio_export
Date: Tue, 9 Nov 2021 11:50:17 +0100	[thread overview]
Message-ID: <CAK8P3a24wkBEAnWG8=LYoVR1oiTo0VKZ3iME+FYbDuHXJDjMOw@mail.gmail.com> (raw)
In-Reply-To: <YYpN3LzXz638l6FG@smile.fi.intel.com>

On Tue, Nov 9, 2021 at 11:30 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Tue, Nov 09, 2021 at 11:02:05AM +0100, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > There are only a handful of users of gpio_export() and
> > related functions.
> >
> > As these are just wrappers around the modern gpiod_export()
> > helper, remove the wrappers and open-code the gpio_to_desc
> > in all callers to shrink the legacy API.
>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> What I wish to see meanwhile is a section in the TODO list somewhere to clean
> up those modules that have gpio.h. Linus, do we have one in the kernel or is
> it your personal TODO?
>
> In case we have one in the kernel, please add there modules you modified in
> a way that they still need further attention.

I think the TODO list is in Linus' head, but it would include all the files
that use one of the interfaces in linux/gpio.h. I found about 350 of them,
so there is little point in listing them one at a time. IIRC Linus is going
through those one subsystem at a time.

It might help to make it harder to get new users if we add some pattern
matching to scripts/checkpatch.pl, and/or something for scripts/coccinelle/.
I don't think it's possible to convert a gpio_request() user to gpio_get()
in a scripted way because you usually have to change the platform side
at the same time as the driver side.

I also found that we have a ton of users of linux/of_gpio.h, which is
somewhere inbetween the linux/gpio.h interface and the
linux/gpio/consumer.h version.

> > @@ -259,17 +259,19 @@ static int evm_sw_setup(struct i2c_client *client, int gpio,
> >       char label[10];
> >
> >       for (i = 0; i < 4; ++i) {
> > +             struct gpio_desc *desc = gpio_to_desc(gpio + i);
> > +
> >               snprintf(label, 10, "user_sw%d", i);
> > -             status = gpio_request(gpio, label);
> > +             status = gpio_request(gpio + i, label);
>
> Shouldn't be gpiod_get() or so at the end?

Yes, but that would be a more invasive change that I think should be done
separately.

        Arnd

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	 Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	 Geert Uytterhoeven <geert+renesas@glider.be>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 6/8] gpiolib: remove legacy gpio_export
Date: Tue, 9 Nov 2021 11:50:17 +0100	[thread overview]
Message-ID: <CAK8P3a24wkBEAnWG8=LYoVR1oiTo0VKZ3iME+FYbDuHXJDjMOw@mail.gmail.com> (raw)
In-Reply-To: <YYpN3LzXz638l6FG@smile.fi.intel.com>

On Tue, Nov 9, 2021 at 11:30 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Tue, Nov 09, 2021 at 11:02:05AM +0100, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > There are only a handful of users of gpio_export() and
> > related functions.
> >
> > As these are just wrappers around the modern gpiod_export()
> > helper, remove the wrappers and open-code the gpio_to_desc
> > in all callers to shrink the legacy API.
>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> What I wish to see meanwhile is a section in the TODO list somewhere to clean
> up those modules that have gpio.h. Linus, do we have one in the kernel or is
> it your personal TODO?
>
> In case we have one in the kernel, please add there modules you modified in
> a way that they still need further attention.

I think the TODO list is in Linus' head, but it would include all the files
that use one of the interfaces in linux/gpio.h. I found about 350 of them,
so there is little point in listing them one at a time. IIRC Linus is going
through those one subsystem at a time.

It might help to make it harder to get new users if we add some pattern
matching to scripts/checkpatch.pl, and/or something for scripts/coccinelle/.
I don't think it's possible to convert a gpio_request() user to gpio_get()
in a scripted way because you usually have to change the platform side
at the same time as the driver side.

I also found that we have a ton of users of linux/of_gpio.h, which is
somewhere inbetween the linux/gpio.h interface and the
linux/gpio/consumer.h version.

> > @@ -259,17 +259,19 @@ static int evm_sw_setup(struct i2c_client *client, int gpio,
> >       char label[10];
> >
> >       for (i = 0; i < 4; ++i) {
> > +             struct gpio_desc *desc = gpio_to_desc(gpio + i);
> > +
> >               snprintf(label, 10, "user_sw%d", i);
> > -             status = gpio_request(gpio, label);
> > +             status = gpio_request(gpio + i, label);
>
> Shouldn't be gpiod_get() or so at the end?

Yes, but that would be a more invasive change that I think should be done
separately.

        Arnd

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-11-09 10:50 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 10:01 [PATCH v2 0/8] gpiolib header cleanup Arnd Bergmann
2021-11-09 10:01 ` Arnd Bergmann
2021-11-09 10:02 ` [PATCH v2 1/8] gpiolib: remove irq_to_gpio() definition Arnd Bergmann
2021-11-09 10:02   ` Arnd Bergmann
2021-11-09 10:02 ` [PATCH v2 2/8] gpiolib: remove empty asm/gpio.h files Arnd Bergmann
2021-11-09 10:02   ` Arnd Bergmann
2021-11-09 10:02 ` [PATCH v2 3/8] gpiolib: coldfire: remove custom asm/gpio.h Arnd Bergmann
2021-11-09 10:02   ` Arnd Bergmann
2021-11-09 10:02 ` [PATCH v2 4/8] gpiolib: remove asm-generic/gpio.h Arnd Bergmann
2021-11-09 10:02   ` Arnd Bergmann
2021-11-09 10:19   ` Andy Shevchenko
2021-11-09 10:19     ` Andy Shevchenko
2021-11-09 10:02 ` [PATCH v2 5/8] gpiolib: shrink further Arnd Bergmann
2021-11-09 10:02   ` Arnd Bergmann
2021-11-09 10:24   ` Andy Shevchenko
2021-11-09 10:24     ` Andy Shevchenko
2021-11-09 11:18     ` Arnd Bergmann
2021-11-09 11:18       ` Arnd Bergmann
2021-11-09 22:17       ` Linus Walleij
2021-11-09 22:17         ` Linus Walleij
2021-11-10 12:39         ` Arnd Bergmann
2021-11-10 12:39           ` Arnd Bergmann
2021-11-09 10:02 ` [PATCH v2 6/8] gpiolib: remove legacy gpio_export Arnd Bergmann
2021-11-09 10:02   ` Arnd Bergmann
2021-11-09 10:30   ` Andy Shevchenko
2021-11-09 10:30     ` Andy Shevchenko
2021-11-09 10:50     ` Arnd Bergmann [this message]
2021-11-09 10:50       ` Arnd Bergmann
2021-11-09 20:42       ` Linus Walleij
2021-11-09 20:42         ` Linus Walleij
2021-11-09 22:46         ` Arnd Bergmann
2021-11-09 22:46           ` Arnd Bergmann
2021-11-10  0:03           ` Linus Walleij
2021-11-10  0:03             ` Linus Walleij
2021-11-09 20:33     ` Linus Walleij
2021-11-09 20:33       ` Linus Walleij
2021-11-09 10:02 ` [PATCH v2 7/8] gpiolib: remove gpio_to_chip Arnd Bergmann
2021-11-09 10:02   ` Arnd Bergmann
2021-11-09 10:32   ` Andy Shevchenko
2021-11-09 10:32     ` Andy Shevchenko
2021-11-09 10:54     ` Arnd Bergmann
2021-11-09 10:54       ` Arnd Bergmann
2021-11-09 10:02 ` [PATCH v2 8/8] gpiolib: split linux/gpio/driver.h out of linux/gpio.h Arnd Bergmann
2021-11-09 10:02   ` Arnd Bergmann
2021-11-09 10:34   ` Andy Shevchenko
2021-11-09 10:34     ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK8P3a24wkBEAnWG8=LYoVR1oiTo0VKZ3iME+FYbDuHXJDjMOw@mail.gmail.com' \
    --to=arnd@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=brgl@bgdev.pl \
    --cc=geert+renesas@glider.be \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.