Skip to content

Commit

Permalink
ACPI: properties: Return _DSD hierarchical extension (data) sub-nodes…
Browse files Browse the repository at this point in the history
… 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 <sakari.ailus@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Sakari Ailus authored and Rafael J. Wysocki committed Sep 19, 2017
1 parent 2bd6bf0 commit 0c0bceb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/acpi/property.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,11 +908,12 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
struct fwnode_handle *child)
{
const struct acpi_device *adev = to_acpi_device_node(fwnode);
struct acpi_device *child_adev = NULL;
const struct list_head *head;
struct list_head *next;

if (!child || is_acpi_device_node(child)) {
struct acpi_device *child_adev;

if (adev)
head = &adev->children;
else
Expand All @@ -922,8 +923,8 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
goto nondev;

if (child) {
child_adev = to_acpi_device_node(child);
next = child_adev->node.next;
adev = to_acpi_device_node(child);
next = adev->node.next;
if (next == head) {
child = NULL;
goto nondev;
Expand All @@ -941,8 +942,8 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
const struct acpi_data_node *data = to_acpi_data_node(fwnode);
struct acpi_data_node *dn;

if (child_adev)
head = &child_adev->data.subnodes;
if (adev)
head = &adev->data.subnodes;
else if (data)
head = &data->data.subnodes;
else
Expand Down

0 comments on commit 0c0bceb

Please sign in to comment.