Skip to content

Commit ee48cef

Browse files
Heikki Krogerusrafaeljw
authored andcommitted
ACPI / property: Don't limit named child node matching to data nodes
There is no reason why we should limit the use of fwnode_get_named_child_node() to data nodes only. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent dad9bb0 commit ee48cef

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

drivers/acpi/property.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -603,15 +603,29 @@ static struct fwnode_handle *
603603
acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
604604
const char *childname)
605605
{
606+
char name[ACPI_PATH_SEGMENT_LENGTH];
606607
struct fwnode_handle *child;
608+
struct acpi_buffer path;
609+
acpi_status status;
607610

608-
/*
609-
* Find first matching named child node of this fwnode.
610-
* For ACPI this will be a data only sub-node.
611-
*/
612-
fwnode_for_each_child_node(fwnode, child)
613-
if (acpi_data_node_match(child, childname))
611+
path.length = sizeof(name);
612+
path.pointer = name;
613+
614+
fwnode_for_each_child_node(fwnode, child) {
615+
if (is_acpi_data_node(child)) {
616+
if (acpi_data_node_match(child, childname))
617+
return child;
618+
continue;
619+
}
620+
621+
status = acpi_get_name(ACPI_HANDLE_FWNODE(child),
622+
ACPI_SINGLE_NAME, &path);
623+
if (ACPI_FAILURE(status))
624+
break;
625+
626+
if (!strncmp(name, childname, ACPI_NAMESEG_SIZE))
614627
return child;
628+
}
615629

616630
return NULL;
617631
}

0 commit comments

Comments
 (0)