Merge tag 'devprop-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[linux-2.6-microblaze.git] / drivers / acpi / property.c
index da3ced2..ea3d700 100644 (file)
@@ -600,15 +600,29 @@ static struct fwnode_handle *
 acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
                                 const char *childname)
 {
+       char name[ACPI_PATH_SEGMENT_LENGTH];
        struct fwnode_handle *child;
+       struct acpi_buffer path;
+       acpi_status status;
 
-       /*
-        * Find first matching named child node of this fwnode.
-        * For ACPI this will be a data only sub-node.
-        */
-       fwnode_for_each_child_node(fwnode, child)
-               if (acpi_data_node_match(child, childname))
+       path.length = sizeof(name);
+       path.pointer = name;
+
+       fwnode_for_each_child_node(fwnode, child) {
+               if (is_acpi_data_node(child)) {
+                       if (acpi_data_node_match(child, childname))
+                               return child;
+                       continue;
+               }
+
+               status = acpi_get_name(ACPI_HANDLE_FWNODE(child),
+                                      ACPI_SINGLE_NAME, &path);
+               if (ACPI_FAILURE(status))
+                       break;
+
+               if (!strncmp(name, childname, ACPI_NAMESEG_SIZE))
                        return child;
+       }
 
        return NULL;
 }