2023-07-03 12:34:35

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 0/3] gpiolib: Avpid modifying GPIO chip fwnode

Ideally the GPIO chip data structure has to be constant.
In real life it's not true, but we can make it closer to
that. Hence the series.

Benjamin, would be nice it you can perform regression test for your
case.

Bart, the idea is that this series has to land immediately after
v6.5-rc1 is out so we will have longer time to fix any downsides
and regressions found, if any.

Andy Shevchenko (3):
gpiolib: of: Don't use GPIO chip fwnode in of_gpiochip_*()
gpiolib: acpi: Don't use GPIO chip fwnode in acpi_gpiochip_find()
gpiolib: Do not alter GPIO chip fwnode member

drivers/gpio/gpiolib-acpi.c | 2 +-
drivers/gpio/gpiolib-of.c | 6 +++---
drivers/gpio/gpiolib.c | 16 ++++++++--------
3 files changed, 12 insertions(+), 12 deletions(-)

--
2.40.0.1.gaa8946217a0b



2023-07-03 12:55:11

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 2/3] gpiolib: acpi: Don't use GPIO chip fwnode in acpi_gpiochip_find()

GPIO library should rely only on the GPIO device's fwnode.
Hence, replace GPIO chip fwnode usage by respective fwnode
from GPIO device.

Signed-off-by: Andy Shevchenko <[email protected]>
---
drivers/gpio/gpiolib-acpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 97496c0f9133..cafbf9597ead 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -128,7 +128,7 @@ static bool acpi_gpio_deferred_req_irqs_done;

static int acpi_gpiochip_find(struct gpio_chip *gc, void *data)
{
- return ACPI_HANDLE_FWNODE(gc->fwnode) == data;
+ return ACPI_HANDLE(&gc->gpiodev->dev) == data;
}

/**
--
2.40.0.1.gaa8946217a0b


2023-07-03 13:54:22

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v1 2/3] gpiolib: acpi: Don't use GPIO chip fwnode in acpi_gpiochip_find()

On Mon, Jul 03, 2023 at 03:18:37PM +0300, Andy Shevchenko wrote:

...

> static int acpi_gpiochip_find(struct gpio_chip *gc, void *data)
> {
> - return ACPI_HANDLE_FWNODE(gc->fwnode) == data;
> + return ACPI_HANDLE(&gc->gpiodev->dev) == data;
> }

And after all this may be changed to device_match_acpi_handle().
I'll update it locally, but still wait for the Benjamin to test
this before sending a v2.

--
With Best Regards,
Andy Shevchenko



2023-07-03 14:23:30

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] gpiolib: Avpid modifying GPIO chip fwnode

On Mon, Jul 03, 2023 at 04:06:38PM +0200, Benjamin Tissoires wrote:
> On Mon, Jul 3, 2023 at 2:18 PM Andy Shevchenko
> <[email protected]> wrote:
> >
> > Ideally the GPIO chip data structure has to be constant.
> > In real life it's not true, but we can make it closer to
> > that. Hence the series.
> >
> > Benjamin, would be nice it you can perform regression test for your
> > case.

>
> FWIW:
> Tested-by: Benjamin Tissoires <[email protected]>
>
> I've tested Danny's series + my SSDT override, with and without your
> series on top of the master of hid.git (v6.4+merge of the hid.git tree
> for v6.5-rc1), and in both cases, I can access the I2C-HID node that
> sits on top of the CP2112 USB adapter.

Thank you very much!

I will issue a v2 either today or this week. So Bart will have time to review
that and robots to test more before v6.5-rc1 is out.


> > Bart, the idea is that this series has to land immediately after
> > v6.5-rc1 is out so we will have longer time to fix any downsides
> > and regressions found, if any.

--
With Best Regards,
Andy Shevchenko



2023-07-03 14:23:58

by Benjamin Tissoires

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] gpiolib: Avpid modifying GPIO chip fwnode

On Mon, Jul 3, 2023 at 2:18 PM Andy Shevchenko
<[email protected]> wrote:
>
> Ideally the GPIO chip data structure has to be constant.
> In real life it's not true, but we can make it closer to
> that. Hence the series.
>
> Benjamin, would be nice it you can perform regression test for your
> case.


FWIW:
Tested-by: Benjamin Tissoires <[email protected]>

I've tested Danny's series + my SSDT override, with and without your
series on top of the master of hid.git (v6.4+merge of the hid.git tree
for v6.5-rc1), and in both cases, I can access the I2C-HID node that
sits on top of the CP2112 USB adapter.

Cheers,
Benjamin


>
>
> Bart, the idea is that this series has to land immediately after
> v6.5-rc1 is out so we will have longer time to fix any downsides
> and regressions found, if any.
>
> Andy Shevchenko (3):
> gpiolib: of: Don't use GPIO chip fwnode in of_gpiochip_*()
> gpiolib: acpi: Don't use GPIO chip fwnode in acpi_gpiochip_find()
> gpiolib: Do not alter GPIO chip fwnode member
>
> drivers/gpio/gpiolib-acpi.c | 2 +-
> drivers/gpio/gpiolib-of.c | 6 +++---
> drivers/gpio/gpiolib.c | 16 ++++++++--------
> 3 files changed, 12 insertions(+), 12 deletions(-)
>
> --
> 2.40.0.1.gaa8946217a0b
>