mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] gpiolib: acpi: Fix GPIO lookup using relative path
@ 2026-10-01 15:23 Alban Bedel
  2026-10-02  4:36 ` Mika Westerberg
  0 siblings, 1 reply; 3+ messages in thread
From: Alban Bedel @ 2026-10-01 15:23 UTC (permalink / raw)
  To: linux-gpio, linux-acpi
  Cc: linux-kernel, Mika Westerberg, Andy Shevchenko, Linus Walleij,
	Bartosz Golaszewski, Alban Bedel

ACPI allow to use relative path in resources, pass the device handle
to acpi_get_gpiod() to allow resolving such path.

Signed-off-by: Alban Bedel <alban.bedel@lht.dlh.de>
---
 drivers/gpio/gpiolib-acpi-core.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpiolib-acpi-core.c b/drivers/gpio/gpiolib-acpi-core.c
index 220f0ac4204ef..16f0196ad0742 100644
--- a/drivers/gpio/gpiolib-acpi-core.c
+++ b/drivers/gpio/gpiolib-acpi-core.c
@@ -116,7 +116,8 @@ static int acpi_gpiochip_find(struct gpio_chip *gc, const void *data)
 
 /**
  * acpi_get_gpiod() - Translate ACPI GPIO pin to GPIO descriptor usable with GPIO API
- * @path:	ACPI GPIO controller full path name, (e.g. "\\_SB.GPO1")
+ * @parent:	parent ACPI handle to resolve relative path
+ * @path:	ACPI GPIO controller path name, (e.g. "\\_SB.GPO1" or "^GP01")
  * @pin:	ACPI GPIO pin number (0-based, controller-relative)
  *
  * Returns:
@@ -128,12 +129,13 @@ static int acpi_gpiochip_find(struct gpio_chip *gc, const void *data)
  * controller does not have GPIO chip registered at the moment. This is to
  * support probe deferral.
  */
-static struct gpio_desc *acpi_get_gpiod(char *path, unsigned int pin)
+static struct gpio_desc *acpi_get_gpiod(acpi_handle parent,
+					char *path, unsigned int pin)
 {
 	acpi_handle handle;
 	acpi_status status;
 
-	status = acpi_get_handle(NULL, path, &handle);
+	status = acpi_get_handle(parent, path, &handle);
 	if (ACPI_FAILURE(status))
 		return ERR_PTR(-ENODEV);
 
@@ -733,7 +735,8 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
 		if (info->quirks & ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER)
 			desc = gpio_to_desc(agpio->pin_table[pin_index]);
 		else
-			desc = acpi_get_gpiod(agpio->resource_source.string_ptr,
+			desc = acpi_get_gpiod(acpi_device_handle(info->adev),
+					      agpio->resource_source.string_ptr,
 					      agpio->pin_table[pin_index]);
 		lookup->desc = desc;
 		info->pin_config = agpio->pin_config;
-- 
2.39.5


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-02  7:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-01 15:23 [PATCH] gpiolib: acpi: Fix GPIO lookup using relative path Alban Bedel
2026-10-02  4:36 ` Mika Westerberg
2026-10-02  7:09   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®