blob: a27f79f04f945ad425eba68fe1a1b0faed4fe7a4 [file]
From ed2179fe8a7c76a505c4f7c5592cf8155bdf2fb8 Mon Sep 17 00:00:00 2001
From: Sasha Levin <sashal@kernel.org>
Date: Thu, 1 Oct 2026 17:35:07 +0200
Subject: spi: Fix ACPI SPI resources using relative path
From: Alban Bedel <alban.bedel@lht.dlh.de>
[ Upstream commit 4825287f6d2346e9273f35a928d1ef40e68bc58b ]
ACPI resources can use relative path when pointing to other
resources. This didn't work with SPISerialBus resources because the
device defining the resource was not passed to acpi_get_handle().
Pass the ACPI device handle through the lookup context to also allow
for relative paths.
Signed-off-by: Alban Bedel <alban.bedel@lht.dlh.de>
Link: https://patch.msgid.link/20261001153507.2011806-1-alban.bedel@lht.dlh.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 2d0953ab69d3 ("spi: acpi: only look up the IRQ of confirmed SPI devices")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 172141650b648..e5ef3ca769d53 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2983,6 +2983,7 @@ EXPORT_SYMBOL_GPL(devm_spi_new_ancillary_device);
#ifdef CONFIG_ACPI
struct acpi_spi_lookup {
struct spi_controller *ctlr;
+ acpi_handle device_handle;
u32 max_speed_hz;
u32 mode;
int irq;
@@ -3077,7 +3078,7 @@ static int acpi_spi_add_resource(struct acpi_resource *ares, void *data)
if (lookup->index != -1 && lookup->n++ != lookup->index)
return 1;
- status = acpi_get_handle(NULL,
+ status = acpi_get_handle(lookup->device_handle,
sb->resource_source.string_ptr,
&parent_handle);
@@ -3169,6 +3170,7 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
return ERR_PTR(-EINVAL);
lookup.ctlr = ctlr;
+ lookup.device_handle = acpi_device_handle(adev);
lookup.irq = -1;
lookup.index = index;
lookup.n = 0;
--
2.53.0