[PATCH v2 02/16] ACPI: property: Use ACPI functions in acpi_graph_get_next_endpoint() only

Sakari Ailus posted 16 patches 1 week ago
[PATCH v2 02/16] ACPI: property: Use ACPI functions in acpi_graph_get_next_endpoint() only
Posted by Sakari Ailus 1 week ago
Calling fwnode_get_next_child_node() in ACPI implementation of the fwnode
property API is somewhat problematic as the latter is used in the
impelementation of the former. Instead of using
fwnode_get_next_child_node() in acpi_graph_get_next_endpoint(), call
acpi_get_next_subnode() directly instead.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/acpi/property.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 5435628c67e7..3e85900080ac 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -1381,7 +1381,7 @@ static struct fwnode_handle *acpi_graph_get_next_endpoint(
 
 	if (!prev) {
 		do {
-			port = fwnode_get_next_child_node(fwnode, port);
+			port = acpi_get_next_subnode(fwnode, port);
 			/*
 			 * The names of the port nodes begin with "port@"
 			 * followed by the number of the port node and they also
@@ -1399,13 +1399,13 @@ static struct fwnode_handle *acpi_graph_get_next_endpoint(
 	if (!port)
 		return NULL;
 
-	endpoint = fwnode_get_next_child_node(port, prev);
+	endpoint = acpi_get_next_subnode(port, prev);
 	while (!endpoint) {
-		port = fwnode_get_next_child_node(fwnode, port);
+		port = acpi_get_next_subnode(fwnode, port);
 		if (!port)
 			break;
 		if (is_acpi_graph_node(port, "port"))
-			endpoint = fwnode_get_next_child_node(port, NULL);
+			endpoint = acpi_get_next_subnode(port, NULL);
 	}
 
 	/*
-- 
2.47.3
Re: [PATCH v2 02/16] ACPI: property: Use ACPI functions in acpi_graph_get_next_endpoint() only
Posted by Jonathan Cameron 2 days, 17 hours ago
On Wed, 24 Sep 2025 10:45:48 +0300
Sakari Ailus <sakari.ailus@linux.intel.com> wrote:

> Calling fwnode_get_next_child_node() in ACPI implementation of the fwnode
> property API is somewhat problematic as the latter is used in the
> impelementation of the former. Instead of using
> fwnode_get_next_child_node() in acpi_graph_get_next_endpoint(), call
> acpi_get_next_subnode() directly instead.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Makes sense to me on simply basis of making reasoning about it a little simpler.

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Re: [PATCH v2 02/16] ACPI: property: Use ACPI functions in acpi_graph_get_next_endpoint() only
Posted by Laurent Pinchart 1 week ago
On Wed, Sep 24, 2025 at 10:45:48AM +0300, Sakari Ailus wrote:
> Calling fwnode_get_next_child_node() in ACPI implementation of the fwnode
> property API is somewhat problematic as the latter is used in the
> impelementation of the former. Instead of using
> fwnode_get_next_child_node() in acpi_graph_get_next_endpoint(), call
> acpi_get_next_subnode() directly instead.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

> ---
>  drivers/acpi/property.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
> index 5435628c67e7..3e85900080ac 100644
> --- a/drivers/acpi/property.c
> +++ b/drivers/acpi/property.c
> @@ -1381,7 +1381,7 @@ static struct fwnode_handle *acpi_graph_get_next_endpoint(
>  
>  	if (!prev) {
>  		do {
> -			port = fwnode_get_next_child_node(fwnode, port);
> +			port = acpi_get_next_subnode(fwnode, port);
>  			/*
>  			 * The names of the port nodes begin with "port@"
>  			 * followed by the number of the port node and they also
> @@ -1399,13 +1399,13 @@ static struct fwnode_handle *acpi_graph_get_next_endpoint(
>  	if (!port)
>  		return NULL;
>  
> -	endpoint = fwnode_get_next_child_node(port, prev);
> +	endpoint = acpi_get_next_subnode(port, prev);
>  	while (!endpoint) {
> -		port = fwnode_get_next_child_node(fwnode, port);
> +		port = acpi_get_next_subnode(fwnode, port);
>  		if (!port)
>  			break;
>  		if (is_acpi_graph_node(port, "port"))
> -			endpoint = fwnode_get_next_child_node(port, NULL);
> +			endpoint = acpi_get_next_subnode(port, NULL);
>  	}
>  
>  	/*

-- 
Regards,

Laurent Pinchart