diff mbox series

[v1] ACPI: property: Use acpi_dev_parent()

Message ID 4756666.GXAFRqVoOG@kreacher (mailing list archive)
State Mainlined, archived
Headers show
Series [v1] ACPI: property: Use acpi_dev_parent() | expand

Commit Message

Rafael J. Wysocki Aug. 29, 2022, 4:12 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

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.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/property.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Andy Shevchenko Aug. 29, 2022, 5 p.m. UTC | #1
On Mon, Aug 29, 2022 at 06:12:33PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> 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.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks!

> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/acpi/property.c |    7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> Index: linux-pm/drivers/acpi/property.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/property.c
> +++ 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;
> 
> 
>
diff mbox series

Patch

Index: linux-pm/drivers/acpi/property.c
===================================================================
--- linux-pm.orig/drivers/acpi/property.c
+++ 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;