Skip to content

Commit b889ed5

Browse files
Sakari Ailusrafaeljw
authored andcommitted
ACPI: property: Rework acpi_graph_get_next_endpoint()
Rework the code obtaining the next endpoint in acpi_graph_get_next_endpoint(). The resulting code removes unnecessary contitionals and should be easier to follow. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Link: https://patch.msgid.link/20251001104320.1272752-4-sakari.ailus@linux.intel.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 5d01047 commit b889ed5

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

drivers/acpi/property.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,14 +1491,17 @@ static struct fwnode_handle *acpi_graph_get_next_endpoint(
14911491
if (!port)
14921492
return NULL;
14931493

1494-
endpoint = acpi_get_next_subnode(port, prev);
1495-
while (!endpoint) {
1496-
port = acpi_get_next_subnode(fwnode, port);
1497-
if (!port)
1494+
do {
1495+
endpoint = acpi_get_next_subnode(port, prev);
1496+
if (endpoint)
14981497
break;
1499-
if (is_acpi_graph_node(port, "port"))
1500-
endpoint = acpi_get_next_subnode(port, NULL);
1501-
}
1498+
1499+
prev = NULL;
1500+
1501+
do {
1502+
port = acpi_get_next_subnode(fwnode, port);
1503+
} while (port && !is_acpi_graph_node(port, "port"));
1504+
} while (port);
15021505

15031506
/*
15041507
* The names of the endpoint nodes begin with "endpoint@" followed by

0 commit comments

Comments
 (0)