2022-09-03 01:00:10

by Dmitry Torokhov

[permalink] [raw]
Subject: [PATCH v1 0/3] Get rid of devm_fwnode_get_[index_]gpiod_from_child()

This drops the last uses of devm_fwnode_get_[index_]gpiod_from_child()
from the tree and drops the stubs implementing this API on top of
devm_fwnode_gpiod_get_index().

Note that the bulk of users were converted in 2019, the couple of LED
drivers are all that have remained.

Signed-off-by: Dmitry Torokhov <[email protected]>

---
Dmitry Torokhov (3):
leds: gpio: switch to using devm_fwnode_gpiod_get()
leds: lgm-sso: switch to using devm_fwnode_gpiod_get()
gpiolib: remove devm_fwnode_get_[index_]gpiod_from_child()

drivers/leds/blink/leds-lgm-sso.c | 5 ++---
drivers/leds/leds-gpio.c | 5 ++---
include/linux/gpio/consumer.h | 21 ---------------------
3 files changed, 4 insertions(+), 27 deletions(-)
---
base-commit: 7fd22855300e693668c3397771b3a2b3948f827a
change-id: 20220902-get_gpiod_from_child-remove-a62638849e91

Best regards,
--
Dmitry


2022-09-03 01:14:17

by Dmitry Torokhov

[permalink] [raw]
Subject: [PATCH v1 1/3] leds: gpio: switch to using devm_fwnode_gpiod_get()

devm_fwnode_get_gpiod_from_child() is going away as the name is too
unwieldy, let's switch to using the new devm_fwnode_gpiod_get().

Signed-off-by: Dmitry Torokhov <[email protected]>

diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 092eb59a7d32..ce4e79939731 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -151,9 +151,8 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
* will be updated after LED class device is registered,
* Only then the final LED name is known.
*/
- led.gpiod = devm_fwnode_get_gpiod_from_child(dev, NULL, child,
- GPIOD_ASIS,
- NULL);
+ led.gpiod = devm_fwnode_gpiod_get(dev, child, NULL, GPIOD_ASIS,
+ NULL);
if (IS_ERR(led.gpiod)) {
fwnode_handle_put(child);
return ERR_CAST(led.gpiod);

--
b4 0.10.0-dev-fc921

2022-09-03 01:15:33

by Dmitry Torokhov

[permalink] [raw]
Subject: [PATCH v1 3/3] gpiolib: remove devm_fwnode_get_[index_]gpiod_from_child()

Now that there are no more users of these APIs in the kernel we can
remove them.

Signed-off-by: Dmitry Torokhov <[email protected]>

diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index fe0f460d9a3b..2ccda8567533 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -594,27 +594,6 @@ struct gpio_desc *devm_fwnode_gpiod_get(struct device *dev,
flags, label);
}

-static inline
-struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev,
- const char *con_id, int index,
- struct fwnode_handle *child,
- enum gpiod_flags flags,
- const char *label)
-{
- return devm_fwnode_gpiod_get_index(dev, child, con_id, index,
- flags, label);
-}
-
-static inline
-struct gpio_desc *devm_fwnode_get_gpiod_from_child(struct device *dev,
- const char *con_id,
- struct fwnode_handle *child,
- enum gpiod_flags flags,
- const char *label)
-{
- return devm_fwnode_gpiod_get_index(dev, child, con_id, 0, flags, label);
-}
-
#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_OF_GPIO)
struct device_node;


--
b4 0.10.0-dev-fc921

2022-09-03 01:26:58

by Dmitry Torokhov

[permalink] [raw]
Subject: [PATCH v1 2/3] leds: lgm-sso: switch to using devm_fwnode_gpiod_get()

devm_fwnode_get_gpiod_from_child() is going away as the name is too
unwieldy, let's switch to using the new devm_fwnode_gpiod_get().

Signed-off-by: Dmitry Torokhov <[email protected]>

diff --git a/drivers/leds/blink/leds-lgm-sso.c b/drivers/leds/blink/leds-lgm-sso.c
index 6f270c0272fb..35c61311e7fd 100644
--- a/drivers/leds/blink/leds-lgm-sso.c
+++ b/drivers/leds/blink/leds-lgm-sso.c
@@ -635,9 +635,8 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
led->priv = priv;
desc = &led->desc;

- led->gpiod = devm_fwnode_get_gpiod_from_child(dev, NULL,
- fwnode_child,
- GPIOD_ASIS, NULL);
+ led->gpiod = devm_fwnode_gpiod_get(dev, fwnode_child, NULL,
+ GPIOD_ASIS, NULL);
if (IS_ERR(led->gpiod)) {
ret = dev_err_probe(dev, PTR_ERR(led->gpiod), "led: get gpio fail!\n");
goto __dt_err;

--
b4 0.10.0-dev-fc921

2022-09-03 10:32:30

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] Get rid of devm_fwnode_get_[index_]gpiod_from_child()

On Sat, Sep 3, 2022 at 3:59 AM Dmitry Torokhov
<[email protected]> wrote:
>
> This drops the last uses of devm_fwnode_get_[index_]gpiod_from_child()
> from the tree and drops the stubs implementing this API on top of
> devm_fwnode_gpiod_get_index().
>
> Note that the bulk of users were converted in 2019, the couple of LED
> drivers are all that have remained.

Full support and green light from me, thanks!
Reviewed-by: Andy Shevchenko <[email protected]>

P.S. More of the similar is welcome, if you have any!

> Signed-off-by: Dmitry Torokhov <[email protected]>


--
With Best Regards,
Andy Shevchenko

2022-09-03 13:13:32

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] Get rid of devm_fwnode_get_[index_]gpiod_from_child()

On Sat, Sep 3, 2022 at 2:56 AM Dmitry Torokhov
<[email protected]> wrote:

> This drops the last uses of devm_fwnode_get_[index_]gpiod_from_child()
> from the tree and drops the stubs implementing this API on top of
> devm_fwnode_gpiod_get_index().
>
> Note that the bulk of users were converted in 2019, the couple of LED
> drivers are all that have remained.
>
> Signed-off-by: Dmitry Torokhov <[email protected]>

Oh that's neat.
Reviewed-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2022-09-04 20:43:41

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH v1 3/3] gpiolib: remove devm_fwnode_get_[index_]gpiod_from_child()

On Sat, Sep 3, 2022 at 2:56 AM Dmitry Torokhov
<[email protected]> wrote:
>
> Now that there are no more users of these APIs in the kernel we can
> remove them.
>
> Signed-off-by: Dmitry Torokhov <[email protected]>
>
> diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
> index fe0f460d9a3b..2ccda8567533 100644
> --- a/include/linux/gpio/consumer.h
> +++ b/include/linux/gpio/consumer.h
> @@ -594,27 +594,6 @@ struct gpio_desc *devm_fwnode_gpiod_get(struct device *dev,
> flags, label);
> }
>
> -static inline
> -struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev,
> - const char *con_id, int index,
> - struct fwnode_handle *child,
> - enum gpiod_flags flags,
> - const char *label)
> -{
> - return devm_fwnode_gpiod_get_index(dev, child, con_id, index,
> - flags, label);
> -}
> -
> -static inline
> -struct gpio_desc *devm_fwnode_get_gpiod_from_child(struct device *dev,
> - const char *con_id,
> - struct fwnode_handle *child,
> - enum gpiod_flags flags,
> - const char *label)
> -{
> - return devm_fwnode_gpiod_get_index(dev, child, con_id, 0, flags, label);
> -}
> -
> #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_OF_GPIO)
> struct device_node;
>
>
> --
> b4 0.10.0-dev-fc921

Either:

Acked-by: Bartosz Golaszewski <[email protected]>

Or I can take pull an immutable branch from the leds tree.

Bart

2022-09-22 22:22:01

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] Get rid of devm_fwnode_get_[index_]gpiod_from_child()

Hi Pavel, Marek,

On Fri, Sep 02, 2022 at 05:55:24PM -0700, Dmitry Torokhov wrote:
> This drops the last uses of devm_fwnode_get_[index_]gpiod_from_child()
> from the tree and drops the stubs implementing this API on top of
> devm_fwnode_gpiod_get_index().
>
> Note that the bulk of users were converted in 2019, the couple of LED
> drivers are all that have remained.
>
> Signed-off-by: Dmitry Torokhov <[email protected]>
>
> ---
> Dmitry Torokhov (3):
> leds: gpio: switch to using devm_fwnode_gpiod_get()
> leds: lgm-sso: switch to using devm_fwnode_gpiod_get()
> gpiolib: remove devm_fwnode_get_[index_]gpiod_from_child()
>
> drivers/leds/blink/leds-lgm-sso.c | 5 ++---
> drivers/leds/leds-gpio.c | 5 ++---
> include/linux/gpio/consumer.h | 21 ---------------------
> 3 files changed, 4 insertions(+), 27 deletions(-)
> ---
> base-commit: 7fd22855300e693668c3397771b3a2b3948f827a
> change-id: 20220902-get_gpiod_from_child-remove-a62638849e91
>

Could you please consider picking this up for 6.1? Or would you be OK
with this going through other tree (GPIO maybe)?

Thanks.

--
Dmitry

2022-10-24 13:32:11

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] Get rid of devm_fwnode_get_[index_]gpiod_from_child()

On Thu, Sep 22, 2022 at 02:48:26PM -0700, Dmitry Torokhov wrote:
> Hi Pavel, Marek,
>
> On Fri, Sep 02, 2022 at 05:55:24PM -0700, Dmitry Torokhov wrote:
> > This drops the last uses of devm_fwnode_get_[index_]gpiod_from_child()
> > from the tree and drops the stubs implementing this API on top of
> > devm_fwnode_gpiod_get_index().
> >
> > Note that the bulk of users were converted in 2019, the couple of LED
> > drivers are all that have remained.
> >
> > Signed-off-by: Dmitry Torokhov <[email protected]>
> >
> > ---
> > Dmitry Torokhov (3):
> > leds: gpio: switch to using devm_fwnode_gpiod_get()
> > leds: lgm-sso: switch to using devm_fwnode_gpiod_get()
> > gpiolib: remove devm_fwnode_get_[index_]gpiod_from_child()
> >
> > drivers/leds/blink/leds-lgm-sso.c | 5 ++---
> > drivers/leds/leds-gpio.c | 5 ++---
> > include/linux/gpio/consumer.h | 21 ---------------------
> > 3 files changed, 4 insertions(+), 27 deletions(-)
> > ---
> > base-commit: 7fd22855300e693668c3397771b3a2b3948f827a
> > change-id: 20220902-get_gpiod_from_child-remove-a62638849e91
> >
>
> Could you please consider picking this up for 6.1? Or would you be OK
> with this going through other tree (GPIO maybe)?

*ping* Could this go through GPIO tree? Dropping this API helps with
some outstanding work that I have...

Thanks.

--
Dmitry

2022-10-25 16:23:12

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] Get rid of devm_fwnode_get_[index_]gpiod_from_child()

On Mon, Oct 24, 2022 at 2:18 PM Dmitry Torokhov
<[email protected]> wrote:
>
> On Thu, Sep 22, 2022 at 02:48:26PM -0700, Dmitry Torokhov wrote:
> > Hi Pavel, Marek,
> >
> > On Fri, Sep 02, 2022 at 05:55:24PM -0700, Dmitry Torokhov wrote:
> > > This drops the last uses of devm_fwnode_get_[index_]gpiod_from_child()
> > > from the tree and drops the stubs implementing this API on top of
> > > devm_fwnode_gpiod_get_index().
> > >
> > > Note that the bulk of users were converted in 2019, the couple of LED
> > > drivers are all that have remained.
> > >
> > > Signed-off-by: Dmitry Torokhov <[email protected]>
> > >
> > > ---
> > > Dmitry Torokhov (3):
> > > leds: gpio: switch to using devm_fwnode_gpiod_get()
> > > leds: lgm-sso: switch to using devm_fwnode_gpiod_get()
> > > gpiolib: remove devm_fwnode_get_[index_]gpiod_from_child()
> > >
> > > drivers/leds/blink/leds-lgm-sso.c | 5 ++---
> > > drivers/leds/leds-gpio.c | 5 ++---
> > > include/linux/gpio/consumer.h | 21 ---------------------
> > > 3 files changed, 4 insertions(+), 27 deletions(-)
> > > ---
> > > base-commit: 7fd22855300e693668c3397771b3a2b3948f827a
> > > change-id: 20220902-get_gpiod_from_child-remove-a62638849e91
> > >
> >
> > Could you please consider picking this up for 6.1? Or would you be OK
> > with this going through other tree (GPIO maybe)?
>
> *ping* Could this go through GPIO tree? Dropping this API helps with
> some outstanding work that I have...
>

Sure! I'll let it wait for another week - it would be great to get an
ack from Pavel - but in case of no response I'll take it through my
tree.

Bart

2022-11-08 05:44:25

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] Get rid of devm_fwnode_get_[index_]gpiod_from_child()

On Tue, Oct 25, 2022 at 05:48:02PM +0200, Bartosz Golaszewski wrote:
> On Mon, Oct 24, 2022 at 2:18 PM Dmitry Torokhov
> <[email protected]> wrote:
> >
> > On Thu, Sep 22, 2022 at 02:48:26PM -0700, Dmitry Torokhov wrote:
> > > Hi Pavel, Marek,
> > >
> > > On Fri, Sep 02, 2022 at 05:55:24PM -0700, Dmitry Torokhov wrote:
> > > > This drops the last uses of devm_fwnode_get_[index_]gpiod_from_child()
> > > > from the tree and drops the stubs implementing this API on top of
> > > > devm_fwnode_gpiod_get_index().
> > > >
> > > > Note that the bulk of users were converted in 2019, the couple of LED
> > > > drivers are all that have remained.
> > > >
> > > > Signed-off-by: Dmitry Torokhov <[email protected]>
> > > >
> > > > ---
> > > > Dmitry Torokhov (3):
> > > > leds: gpio: switch to using devm_fwnode_gpiod_get()
> > > > leds: lgm-sso: switch to using devm_fwnode_gpiod_get()
> > > > gpiolib: remove devm_fwnode_get_[index_]gpiod_from_child()
> > > >
> > > > drivers/leds/blink/leds-lgm-sso.c | 5 ++---
> > > > drivers/leds/leds-gpio.c | 5 ++---
> > > > include/linux/gpio/consumer.h | 21 ---------------------
> > > > 3 files changed, 4 insertions(+), 27 deletions(-)
> > > > ---
> > > > base-commit: 7fd22855300e693668c3397771b3a2b3948f827a
> > > > change-id: 20220902-get_gpiod_from_child-remove-a62638849e91
> > > >
> > >
> > > Could you please consider picking this up for 6.1? Or would you be OK
> > > with this going through other tree (GPIO maybe)?
> >
> > *ping* Could this go through GPIO tree? Dropping this API helps with
> > some outstanding work that I have...
> >
>
> Sure! I'll let it wait for another week - it would be great to get an
> ack from Pavel - but in case of no response I'll take it through my
> tree.

Pavel, any chance we could get an Ack for this?

Thanks!

--
Dmitry

2022-11-08 11:49:33

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] Get rid of devm_fwnode_get_[index_]gpiod_from_child()

On Tue, Oct 25, 2022 at 5:48 PM Bartosz Golaszewski <[email protected]> wrote:

> On Mon, Oct 24, 2022 at 2:18 PM Dmitry Torokhov
> <[email protected]> wrote:
> >
> > On Thu, Sep 22, 2022 at 02:48:26PM -0700, Dmitry Torokhov wrote:
> > > Hi Pavel, Marek,
> > >
> > > On Fri, Sep 02, 2022 at 05:55:24PM -0700, Dmitry Torokhov wrote:
> > > > This drops the last uses of devm_fwnode_get_[index_]gpiod_from_child()
> > > > from the tree and drops the stubs implementing this API on top of
> > > > devm_fwnode_gpiod_get_index().
> > > >
> > > > Note that the bulk of users were converted in 2019, the couple of LED
> > > > drivers are all that have remained.
> > > >
> > > > Signed-off-by: Dmitry Torokhov <[email protected]>
> > > >
> > > > ---
> > > > Dmitry Torokhov (3):
> > > > leds: gpio: switch to using devm_fwnode_gpiod_get()
> > > > leds: lgm-sso: switch to using devm_fwnode_gpiod_get()
> > > > gpiolib: remove devm_fwnode_get_[index_]gpiod_from_child()
> > > >
> > > > drivers/leds/blink/leds-lgm-sso.c | 5 ++---
> > > > drivers/leds/leds-gpio.c | 5 ++---
> > > > include/linux/gpio/consumer.h | 21 ---------------------
> > > > 3 files changed, 4 insertions(+), 27 deletions(-)
> > > > ---
> > > > base-commit: 7fd22855300e693668c3397771b3a2b3948f827a
> > > > change-id: 20220902-get_gpiod_from_child-remove-a62638849e91
> > > >
> > >
> > > Could you please consider picking this up for 6.1? Or would you be OK
> > > with this going through other tree (GPIO maybe)?
> >
> > *ping* Could this go through GPIO tree? Dropping this API helps with
> > some outstanding work that I have...
> >
>
> Sure! I'll let it wait for another week - it would be great to get an
> ack from Pavel - but in case of no response I'll take it through my
> tree.

I'd say just apply it at this point.

Yours,
Linus Walleij

2022-11-09 13:34:22

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] Get rid of devm_fwnode_get_[index_]gpiod_from_child()

On Tue, Nov 8, 2022 at 11:54 AM Linus Walleij <[email protected]> wrote:
>
> On Tue, Oct 25, 2022 at 5:48 PM Bartosz Golaszewski <[email protected]> wrote:
>
> > On Mon, Oct 24, 2022 at 2:18 PM Dmitry Torokhov
> > <[email protected]> wrote:
> > >
> > > On Thu, Sep 22, 2022 at 02:48:26PM -0700, Dmitry Torokhov wrote:
> > > > Hi Pavel, Marek,
> > > >
> > > > On Fri, Sep 02, 2022 at 05:55:24PM -0700, Dmitry Torokhov wrote:
> > > > > This drops the last uses of devm_fwnode_get_[index_]gpiod_from_child()
> > > > > from the tree and drops the stubs implementing this API on top of
> > > > > devm_fwnode_gpiod_get_index().
> > > > >
> > > > > Note that the bulk of users were converted in 2019, the couple of LED
> > > > > drivers are all that have remained.
> > > > >
> > > > > Signed-off-by: Dmitry Torokhov <[email protected]>
> > > > >
> > > > > ---
> > > > > Dmitry Torokhov (3):
> > > > > leds: gpio: switch to using devm_fwnode_gpiod_get()
> > > > > leds: lgm-sso: switch to using devm_fwnode_gpiod_get()
> > > > > gpiolib: remove devm_fwnode_get_[index_]gpiod_from_child()
> > > > >
> > > > > drivers/leds/blink/leds-lgm-sso.c | 5 ++---
> > > > > drivers/leds/leds-gpio.c | 5 ++---
> > > > > include/linux/gpio/consumer.h | 21 ---------------------
> > > > > 3 files changed, 4 insertions(+), 27 deletions(-)
> > > > > ---
> > > > > base-commit: 7fd22855300e693668c3397771b3a2b3948f827a
> > > > > change-id: 20220902-get_gpiod_from_child-remove-a62638849e91
> > > > >
> > > >
> > > > Could you please consider picking this up for 6.1? Or would you be OK
> > > > with this going through other tree (GPIO maybe)?
> > >
> > > *ping* Could this go through GPIO tree? Dropping this API helps with
> > > some outstanding work that I have...
> > >
> >
> > Sure! I'll let it wait for another week - it would be great to get an
> > ack from Pavel - but in case of no response I'll take it through my
> > tree.
>
> I'd say just apply it at this point.
>

Right. Applied to gpio/for-next.

Thanks!
Bartosz