summaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorHeikki Krogerus2019-05-31 16:15:38 +0200
committerRafael J. Wysocki2019-06-03 10:55:38 +0200
commitee48cef6c3917092eeee230caaa508d0e487c288 (patch)
tree64e181118abd9e1689e569b3c407d44a6b8e3df6 /drivers/acpi
parentdriver core: Add helper device_find_child_by_name() (diff)
downloadkernel-qcow2-linux-ee48cef6c3917092eeee230caaa508d0e487c288.tar.gz
kernel-qcow2-linux-ee48cef6c3917092eeee230caaa508d0e487c288.tar.xz
kernel-qcow2-linux-ee48cef6c3917092eeee230caaa508d0e487c288.zip
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>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/property.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 9d460a859be0..39c64291098f 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -603,15 +603,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;
}