Re: [PATCH 01/14] ACPI: property: Use ACPI functions in acpi_graph_get_next_endpoint() only

Andy Shevchenko
2025-09-17T07:17:47Z

On Tue, Sep 16, 2025 at 07:01:16PM +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.

...

> - 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);
> }

Can this be refactored to

do {
endpoint = acpi_get_next_subnode(port, prev);
if (endpoint)
break;

port = acpi_get_next_subnode(fwnode, port);
if (is_acpi_graph_node(port, "port"))
prev = NULL;
} while (port);

(but it might be a material for further cleanups)?

--
With Best Regards,
Andy Shevchenko