Skip to content

Commit 0c0bceb

Browse files
Sakari Ailusrafaeljw
authored andcommitted
ACPI: properties: Return _DSD hierarchical extension (data) sub-nodes correctly
The recently merged patch "ACPI: Prepare for constifying acpi_get_next_subnode() fwnode argument" was part of a patchset constifying the fwnode arguments across the fwnode property API. The purpose of the patch was to allow returning non-const fwnodes from a data structure the root of which is const. Unfortunately the patch introduced the functionality, in particular when starting parsed from an ACPI device node, the hierarchical data extension nodes would not be enumerated. Restore the old behaviour while still retaining constness properties of the patch. Fixes: 01c1da2 "ACPI: Prepare for constifying acpi_get_next_subnode() fwnode argument" Signed-off-by: Sakari Ailus <[email protected]> Acked-by: Mika Westerberg <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 2bd6bf0 commit 0c0bceb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/acpi/property.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -908,11 +908,12 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
908908
struct fwnode_handle *child)
909909
{
910910
const struct acpi_device *adev = to_acpi_device_node(fwnode);
911-
struct acpi_device *child_adev = NULL;
912911
const struct list_head *head;
913912
struct list_head *next;
914913

915914
if (!child || is_acpi_device_node(child)) {
915+
struct acpi_device *child_adev;
916+
916917
if (adev)
917918
head = &adev->children;
918919
else
@@ -922,8 +923,8 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
922923
goto nondev;
923924

924925
if (child) {
925-
child_adev = to_acpi_device_node(child);
926-
next = child_adev->node.next;
926+
adev = to_acpi_device_node(child);
927+
next = adev->node.next;
927928
if (next == head) {
928929
child = NULL;
929930
goto nondev;
@@ -941,8 +942,8 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
941942
const struct acpi_data_node *data = to_acpi_data_node(fwnode);
942943
struct acpi_data_node *dn;
943944

944-
if (child_adev)
945-
head = &child_adev->data.subnodes;
945+
if (adev)
946+
head = &adev->data.subnodes;
946947
else if (data)
947948
head = &data->data.subnodes;
948949
else

0 commit comments

Comments
 (0)