ACPI: property: Use acpi_dev_parent()

After introducing acpi_dev_parent() in commit 62fcb99bdf ("ACPI: Drop
parent field from struct acpi_device"), it is better to use it instead
of accessing the dev.parent field in struct acpi_device directly.

Modify acpi_node_get_parent() accordingly.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
Rafael J. Wysocki 2022-08-29 18:12:33 +02:00
parent e3b9b27865
commit 98378956a4

View File

@ -1270,10 +1270,11 @@ acpi_node_get_parent(const struct fwnode_handle *fwnode)
return to_acpi_data_node(fwnode)->parent;
}
if (is_acpi_device_node(fwnode)) {
struct device *dev = to_acpi_device_node(fwnode)->dev.parent;
struct acpi_device *parent;
if (dev)
return acpi_fwnode_handle(to_acpi_device(dev));
parent = acpi_dev_parent(to_acpi_device_node(fwnode));
if (parent)
return acpi_fwnode_handle(parent);
}
return NULL;