Skip to contentSkip to conversation

ACPI: property: Use acpi_dev_parent()

PATCH In review Rafael J. Wysocki 2 participants 2 messages Aug 29, 2022 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: property: Use acpi_dev_parent()

From: Rafael J. Wysocki <[email protected]>

After introducing acpi_dev_parent() in commit 62fcb99bdf10 ("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.

---
 drivers/acpi/property.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/acpi/property.c +4 -3
Index: linux-pm/drivers/acpi/property.c
===================================================================
@@ -1269,10 +1269,11 @@ acpi_node_get_parent(const struct 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;
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

After introducing acpi_dev_parent() in commit 62fcb99bdf10 ("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.

Thanks!

Quoted 28 lines
---
 drivers/acpi/property.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: linux-pm/drivers/acpi/property.c
===================================================================

drivers/acpi/property.c +4 -3
@@ -1269,10 +1269,11 @@ acpi_node_get_parent(const struct 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;
Signature · 2 lines
With Best Regards,
Andy Shevchenko