Skip to content

Commit 07d2e59

Browse files
Lorenzo Pieralisictmarinas
authored andcommitted
ACPI/IORT: Make iort_match_node_callback walk the ACPI namespace for NC
When the iort_match_node_callback is invoked for a named component the match should be executed upon a device with an ACPI companion. For devices with no ACPI companion set-up the ACPI device tree must be walked in order to find the first parent node with a companion set and check the parent node against the named component entry to check whether there is a match and therefore an IORT node describing the in/out ID translation for the device has been found. Signed-off-by: Lorenzo Pieralisi <[email protected]> Cc: Will Deacon <[email protected]> Cc: Hanjun Guo <[email protected]> Cc: Sudeep Holla <[email protected]> Cc: Robin Murphy <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 9ebcfad commit 07d2e59

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

drivers/acpi/arm64/iort.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,15 +264,31 @@ static acpi_status iort_match_node_callback(struct acpi_iort_node *node,
264264

265265
if (node->type == ACPI_IORT_NODE_NAMED_COMPONENT) {
266266
struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
267-
struct acpi_device *adev = to_acpi_device_node(dev->fwnode);
267+
struct acpi_device *adev;
268268
struct acpi_iort_named_component *ncomp;
269+
struct device *nc_dev = dev;
270+
271+
/*
272+
* Walk the device tree to find a device with an
273+
* ACPI companion; there is no point in scanning
274+
* IORT for a device matching a named component if
275+
* the device does not have an ACPI companion to
276+
* start with.
277+
*/
278+
do {
279+
adev = ACPI_COMPANION(nc_dev);
280+
if (adev)
281+
break;
282+
283+
nc_dev = nc_dev->parent;
284+
} while (nc_dev);
269285

270286
if (!adev)
271287
goto out;
272288

273289
status = acpi_get_name(adev->handle, ACPI_FULL_PATHNAME, &buf);
274290
if (ACPI_FAILURE(status)) {
275-
dev_warn(dev, "Can't get device full path name\n");
291+
dev_warn(nc_dev, "Can't get device full path name\n");
276292
goto out;
277293
}
278294

0 commit comments

Comments
 (0)