Devyn Liu adbc49a5a8 gpiolib: acpi: Fix failed in acpi_gpiochip_find() by adding parent node match
Previous patch modified the standard used by acpi_gpiochip_find()
to match device nodes. Using the device node set in gc->gpiodev->d-
ev instead of gc->parent.

However, there is a situation in gpio-dwapb where the GPIO device
driver will set gc->fwnode for each port corresponding to a child
node under a GPIO device, so gc->gpiodev->dev will be assigned the
value of each child node in gpiochip_add_data().

gpio-dwapb.c:
128,31 static int dwapb_gpio_add_port(struct dwapb_gpio *gpio,
			       struct dwapb_port_property *pp,
			       unsigned int offs);
port->gc.fwnode = pp->fwnode;

693,39 static int dwapb_gpio_probe;
err = dwapb_gpio_add_port(gpio, &pdata->properties[i], i);

When other drivers request GPIO pin resources through the GPIO device
node provided by ACPI (corresponding to the parent node), the change
of the matching object to gc->gpiodev->dev in acpi_gpiochip_find()
only allows finding the value of each port (child node), resulting
in a failed request.

Reapply the condition of using gc->parent for match in acpi_gpio-
chip_find() in the code can compatible with the problem of gpio-dwapb,
and will not affect the two cases mentioned in the patch:
1. There is no setting for gc->fwnode.
2. The case that depends on using gc->fwnode for match.

Fixes: 5062e4c14b75 ("gpiolib: acpi: use the fwnode in acpi_gpiochip_find()")
Fixes: 067dbc1ea5ce ("gpiolib: acpi: Don't use GPIO chip fwnode in acpi_gpiochip_find()")
Signed-off-by: Devyn Liu <liudingyuan@huawei.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2024-05-21 18:46:45 +03:00
..
2021-04-14 10:19:22 +01:00
2024-02-12 10:12:41 +01:00
2023-10-13 08:39:30 +02:00
2021-05-05 16:07:41 +02:00
2022-10-26 14:52:01 +02:00
2023-12-18 13:43:06 +01:00
2022-10-08 09:46:29 -07:00
2023-10-04 11:37:25 +02:00
2023-08-21 10:39:58 +02:00
2022-06-21 18:01:11 +03:00
2023-03-06 12:33:02 +02:00
2024-02-26 16:43:51 +01:00
2023-10-31 17:21:54 -10:00
2022-01-14 18:50:52 -05:00
2023-08-29 10:21:56 -07:00
2019-12-09 10:40:18 +01:00
2024-05-14 15:07:07 -07:00
2024-05-14 15:07:07 -07:00
2024-05-14 15:07:07 -07:00