* [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* Re: [PATCH] gpiolib: acpi: Fix GPIO lookup using relative path
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
0 siblings, 1 reply; 3+ messages in thread
From: Mika Westerberg @ 2026-10-02 4:36 UTC (permalink / raw)
To: Alban Bedel
Cc: linux-gpio, linux-acpi, linux-kernel, Mika Westerberg,
Andy Shevchenko, Linus Walleij, Bartosz Golaszewski
On Thu, Oct 01, 2026 at 05:23:43PM +0200, Alban Bedel wrote:
> 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>
Acked-by: Mika Westerberg <westeri@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpiolib: acpi: Fix GPIO lookup using relative path
2026-10-02 4:36 ` Mika Westerberg
@ 2026-10-02 7:09 ` Andy Shevchenko
0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2026-10-02 7:09 UTC (permalink / raw)
To: Mika Westerberg
Cc: Alban Bedel, linux-gpio, linux-acpi, linux-kernel,
Mika Westerberg, Linus Walleij, Bartosz Golaszewski
On Fri, Oct 02, 2026 at 06:36:08AM +0200, Mika Westerberg wrote:
> On Thu, Oct 01, 2026 at 05:23:43PM +0200, Alban Bedel wrote:
> > 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>
>
> Acked-by: Mika Westerberg <westeri@kernel.org>
Interestingly that I have no original patch in my mailbox.
Whatever, Alban, do you have IRL case, or is it for the to be
productised platform?
--
With Best Regards,
Andy Shevchenko
^ 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®