2023-10-10 15:19:08

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 0/4] hte: Improve GPIO handling and other cleanups

This is a series provides a new API to GPIO library (so far only
available in the GPIO tree), and respective update to the Tegra
HTE driver. On top a couple of other cleaups (patches 3 & 4, they
can be applied separately).

Patch 2 inherited tags from its respective discussion thread [1],
but I believe the Tested-by needs to be confirmed again.

Due to dependencies this either should be applied to the GPIO tree,
or to the HTE when GPIO updates land the upstream (optionally with
the first patch be applied even now to the GPIO tree independently).

Another option is to have an immutable branch or tag, but I assume
that was discussed and rejected (?) in [1].

Link: https://lore.kernel.org/linux-gpio/[email protected]/ [1]
Cc: Dipen Patel <[email protected]>
Cc: Linus Walleij <[email protected]>

Andy Shevchenko (3):
gpiolib: provide gpio_device_find_by_fwnode()
hte: tegra194: Remove redundant dev_err()
hte: tegra194: Switch to LATE_SIMPLE_DEV_PM_OPS()

Bartosz Golaszewski (1):
hte: tegra194: don't access struct gpio_chip

drivers/gpio/gpiolib.c | 20 ++++++++++++++++
drivers/hte/hte-tegra194.c | 46 +++++++++++++++++++------------------
include/linux/gpio/driver.h | 1 +
3 files changed, 45 insertions(+), 22 deletions(-)

--
2.40.0.1.gaa8946217a0b


2023-10-10 15:19:11

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 1/4] gpiolib: provide gpio_device_find_by_fwnode()

One of the ways of looking up GPIO devices is using their fwnode.
Provide a helper for that to avoid every user implementing their
own matching function.

Signed-off-by: Andy Shevchenko <[email protected]>
---
drivers/gpio/gpiolib.c | 20 ++++++++++++++++++++
include/linux/gpio/driver.h | 1 +
2 files changed, 21 insertions(+)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 7b4d12b714a3..31c06a32cb8a 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1142,6 +1142,26 @@ struct gpio_device *gpio_device_find_by_label(const char *label)
}
EXPORT_SYMBOL_GPL(gpio_device_find_by_label);

+static int gpio_chip_match_by_fwnode(struct gpio_chip *gc, void *fwnode)
+{
+ return device_match_fwnode(&gc->gpiodev->dev, fwnode);
+}
+
+/**
+ * gpio_device_find_by_fwnode() - wrapper around gpio_device_find() finding
+ * the GPIO device by its fwnode
+ * @fwnode: Firmware node to lookup
+ *
+ * Returns:
+ * Reference to the GPIO device or NULL. Reference must be released with
+ * gpio_device_put().
+ */
+struct gpio_device *gpio_device_find_by_fwnode(const struct fwnode_handle *fwnode)
+{
+ return gpio_device_find((void *)fwnode, gpio_chip_match_by_fwnode);
+}
+EXPORT_SYMBOL_GPL(gpio_device_find_by_fwnode);
+
/**
* gpio_device_get() - Increase the reference count of this GPIO device
* @gdev: GPIO device to increase the refcount for
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index f8ad7f40100c..ae4162d3f1d3 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -611,6 +611,7 @@ struct gpio_chip *gpiochip_find(void *data,
struct gpio_device *gpio_device_find(void *data,
int (*match)(struct gpio_chip *gc, void *data));
struct gpio_device *gpio_device_find_by_label(const char *label);
+struct gpio_device *gpio_device_find_by_fwnode(const struct fwnode_handle *fwnode);

struct gpio_device *gpio_device_get(struct gpio_device *gdev);
void gpio_device_put(struct gpio_device *gdev);
--
2.40.0.1.gaa8946217a0b

2023-10-11 09:34:28

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH v1 0/4] hte: Improve GPIO handling and other cleanups

On Tue, Oct 10, 2023 at 5:18 PM Andy Shevchenko
<[email protected]> wrote:
>
> This is a series provides a new API to GPIO library (so far only
> available in the GPIO tree), and respective update to the Tegra
> HTE driver. On top a couple of other cleaups (patches 3 & 4, they
> can be applied separately).
>
> Patch 2 inherited tags from its respective discussion thread [1],
> but I believe the Tested-by needs to be confirmed again.
>
> Due to dependencies this either should be applied to the GPIO tree,
> or to the HTE when GPIO updates land the upstream (optionally with
> the first patch be applied even now to the GPIO tree independently).
>
> Another option is to have an immutable branch or tag, but I assume
> that was discussed and rejected (?) in [1].

The series looks good to me. I'd like to take patches 1 and 2 through
the GPIO tree once v2 is out. This way we could potentially remove
gpiochip_find() for v6.7 already.

Bart

>
> Link: https://lore.kernel.org/linux-gpio/[email protected]/ [1]
> Cc: Dipen Patel <[email protected]>
> Cc: Linus Walleij <[email protected]>
>
> Andy Shevchenko (3):
> gpiolib: provide gpio_device_find_by_fwnode()
> hte: tegra194: Remove redundant dev_err()
> hte: tegra194: Switch to LATE_SIMPLE_DEV_PM_OPS()
>
> Bartosz Golaszewski (1):
> hte: tegra194: don't access struct gpio_chip
>
> drivers/gpio/gpiolib.c | 20 ++++++++++++++++
> drivers/hte/hte-tegra194.c | 46 +++++++++++++++++++------------------
> include/linux/gpio/driver.h | 1 +
> 3 files changed, 45 insertions(+), 22 deletions(-)
>
> --
> 2.40.0.1.gaa8946217a0b
>

2023-10-11 10:08:33

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v1 0/4] hte: Improve GPIO handling and other cleanups

On Wed, Oct 11, 2023 at 11:33:51AM +0200, Bartosz Golaszewski wrote:
> On Tue, Oct 10, 2023 at 5:18 PM Andy Shevchenko
> <[email protected]> wrote:
> >
> > This is a series provides a new API to GPIO library (so far only
> > available in the GPIO tree), and respective update to the Tegra
> > HTE driver. On top a couple of other cleaups (patches 3 & 4, they
> > can be applied separately).
> >
> > Patch 2 inherited tags from its respective discussion thread [1],
> > but I believe the Tested-by needs to be confirmed again.
> >
> > Due to dependencies this either should be applied to the GPIO tree,
> > or to the HTE when GPIO updates land the upstream (optionally with
> > the first patch be applied even now to the GPIO tree independently).
> >
> > Another option is to have an immutable branch or tag, but I assume
> > that was discussed and rejected (?) in [1].
>
> The series looks good to me. I'd like to take patches 1 and 2 through
> the GPIO tree once v2 is out. This way we could potentially remove
> gpiochip_find() for v6.7 already.

It would be nice to see it being removed sooner than later!
I'm waiting for the test results by Dipen, I'll send the v2
ASAP if tests pass.

--
With Best Regards,
Andy Shevchenko


2023-10-11 11:44:00

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v1 0/4] hte: Improve GPIO handling and other cleanups

On Tue, Oct 10, 2023 at 5:18 PM Andy Shevchenko
<[email protected]> wrote:

> This is a series provides a new API to GPIO library (so far only
> available in the GPIO tree), and respective update to the Tegra
> HTE driver. On top a couple of other cleaups (patches 3 & 4, they
> can be applied separately).
>
> Patch 2 inherited tags from its respective discussion thread [1],
> but I believe the Tested-by needs to be confirmed again.
>
> Due to dependencies this either should be applied to the GPIO tree,
> or to the HTE when GPIO updates land the upstream (optionally with
> the first patch be applied even now to the GPIO tree independently).
>
> Another option is to have an immutable branch or tag, but I assume
> that was discussed and rejected (?) in [1].
>
> Link: https://lore.kernel.org/linux-gpio/[email protected]/ [1]
> Cc: Dipen Patel <[email protected]>
> Cc: Linus Walleij <[email protected]>

This is good stuff. The series:
Reviewed-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2023-10-11 18:04:52

by Dipen Patel

[permalink] [raw]
Subject: Re: [PATCH v1 0/4] hte: Improve GPIO handling and other cleanups

On 10/11/23 3:06 AM, Andy Shevchenko wrote:
> On Wed, Oct 11, 2023 at 11:33:51AM +0200, Bartosz Golaszewski wrote:
>> On Tue, Oct 10, 2023 at 5:18 PM Andy Shevchenko
>> <[email protected]> wrote:
>>>
>>> This is a series provides a new API to GPIO library (so far only
>>> available in the GPIO tree), and respective update to the Tegra
>>> HTE driver. On top a couple of other cleaups (patches 3 & 4, they
>>> can be applied separately).
>>>
>>> Patch 2 inherited tags from its respective discussion thread [1],
>>> but I believe the Tested-by needs to be confirmed again.
>>>
>>> Due to dependencies this either should be applied to the GPIO tree,
>>> or to the HTE when GPIO updates land the upstream (optionally with
>>> the first patch be applied even now to the GPIO tree independently).
>>>
>>> Another option is to have an immutable branch or tag, but I assume
>>> that was discussed and rejected (?) in [1].
>>
>> The series looks good to me. I'd like to take patches 1 and 2 through
>> the GPIO tree once v2 is out. This way we could potentially remove
>> gpiochip_find() for v6.7 already.
>
> It would be nice to see it being removed sooner than later!
> I'm waiting for the test results by Dipen, I'll send the v2
> ASAP if tests pass.
>
Reviewed-by: Dipen Patel <[email protected]>
After correcting typo manually
Tested-by: Dipen Patel <[email protected]>

2023-10-13 09:22:27

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v1 1/4] gpiolib: provide gpio_device_find_by_fwnode()

On Tue, Oct 10, 2023 at 5:18 PM Andy Shevchenko
<[email protected]> wrote:


> One of the ways of looking up GPIO devices is using their fwnode.
> Provide a helper for that to avoid every user implementing their
> own matching function.
>
> Signed-off-by: Andy Shevchenko <[email protected]>

This makes sense to me! (But I haven't looked at the rest of the
patches in the series. Yet.)
Acked-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij