aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2017-09-08 05:24:41 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-09-19 17:20:24 -0400
commit0c0bceb796878a5baea1f47033215fac0774e498 (patch)
treefca365eccc0fa0179ea77635a1adc72a024404ed
parent2bd6bf03f4c1c59381d62c61d03f6cc3fe71f66e (diff)
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: 01c1da289791 "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>
-rw-r--r--drivers/acpi/property.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index c1c216163de3..265b74f440b6 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -908,11 +908,12 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
908 struct fwnode_handle *child) 908 struct fwnode_handle *child)
909{ 909{
910 const struct acpi_device *adev = to_acpi_device_node(fwnode); 910 const struct acpi_device *adev = to_acpi_device_node(fwnode);
911 struct acpi_device *child_adev = NULL;
912 const struct list_head *head; 911 const struct list_head *head;
913 struct list_head *next; 912 struct list_head *next;
914 913
915 if (!child || is_acpi_device_node(child)) { 914 if (!child || is_acpi_device_node(child)) {
915 struct acpi_device *child_adev;
916
916 if (adev) 917 if (adev)
917 head = &adev->children; 918 head = &adev->children;
918 else 919 else
@@ -922,8 +923,8 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
922 goto nondev; 923 goto nondev;
923 924
924 if (child) { 925 if (child) {
925 child_adev = to_acpi_device_node(child); 926 adev = to_acpi_device_node(child);
926 next = child_adev->node.next; 927 next = adev->node.next;
927 if (next == head) { 928 if (next == head) {
928 child = NULL; 929 child = NULL;
929 goto nondev; 930 goto nondev;
@@ -941,8 +942,8 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
941 const struct acpi_data_node *data = to_acpi_data_node(fwnode); 942 const struct acpi_data_node *data = to_acpi_data_node(fwnode);
942 struct acpi_data_node *dn; 943 struct acpi_data_node *dn;
943 944
944 if (child_adev) 945 if (adev)
945 head = &child_adev->data.subnodes; 946 head = &adev->data.subnodes;
946 else if (data) 947 else if (data)
947 head = &data->data.subnodes; 948 head = &data->data.subnodes;
948 else 949 else