Skip to content

Commit 9054fc6

Browse files
Sakari Ailusrafaeljw
authored andcommitted
ACPI: Get acpi_device's parent from the parent field
Printk modifier %pfw is used to print the full path of the device name. This is obtained device by device until a device no longer has a parent. On ACPI getting the parent fwnode is done by calling acpi_get_parent() which tries to down() a semaphore. But local IRQs are now disabled in vprintk_store() before the mutex is acquired. This is obviously a problem. Luckily struct device, embedded in struct acpi_device, has a parent field already. Use that field to get the parent instead of relying on acpi_get_parent(). Fixes: 3bd32d6 ("lib/vsprintf: Add %pfw conversion specifier for printing fwnode names") Cc: 5.5+ <[email protected]> # 5.5+ Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 1360572 commit 9054fc6

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/acpi/property.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,15 +1090,10 @@ struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode)
10901090
/* All data nodes have parent pointer so just return that */
10911091
return to_acpi_data_node(fwnode)->parent;
10921092
} else if (is_acpi_device_node(fwnode)) {
1093-
acpi_handle handle, parent_handle;
1093+
struct device *dev = to_acpi_device_node(fwnode)->dev.parent;
10941094

1095-
handle = to_acpi_device_node(fwnode)->handle;
1096-
if (ACPI_SUCCESS(acpi_get_parent(handle, &parent_handle))) {
1097-
struct acpi_device *adev;
1098-
1099-
if (!acpi_bus_get_device(parent_handle, &adev))
1100-
return acpi_fwnode_handle(adev);
1101-
}
1095+
if (dev)
1096+
return acpi_fwnode_handle(to_acpi_device(dev));
11021097
}
11031098

11041099
return NULL;

0 commit comments

Comments
 (0)