aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2019-05-31 10:15:35 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-06-03 04:55:38 -0400
commitc959d0c231f7063b14d766cfecc1fe90c2ab5061 (patch)
tree303c742ce363166618aa088d32882f071ed0bc4e
parent80488a6b1d3c3509b69d38d7c5ac7615889ea7e0 (diff)
software node: Use kobject name when finding child nodes by name
Using the kobject name of the node instead of a device property "name" in software_node_get_named_child_node(). 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>
-rw-r--r--drivers/base/swnode.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
index ef1a48fec718..2d925fc2255f 100644
--- a/drivers/base/swnode.c
+++ b/drivers/base/swnode.c
@@ -546,17 +546,13 @@ software_node_get_named_child_node(const struct fwnode_handle *fwnode,
546 const char *childname) 546 const char *childname)
547{ 547{
548 struct swnode *swnode = to_swnode(fwnode); 548 struct swnode *swnode = to_swnode(fwnode);
549 const struct property_entry *prop;
550 struct swnode *child; 549 struct swnode *child;
551 550
552 if (!swnode || list_empty(&swnode->children)) 551 if (!swnode || list_empty(&swnode->children))
553 return NULL; 552 return NULL;
554 553
555 list_for_each_entry(child, &swnode->children, entry) { 554 list_for_each_entry(child, &swnode->children, entry) {
556 prop = property_entry_get(child->node->properties, "name"); 555 if (!strcmp(childname, kobject_name(&child->kobj))) {
557 if (!prop)
558 continue;
559 if (!strcmp(childname, prop->value.str)) {
560 kobject_get(&child->kobj); 556 kobject_get(&child->kobj);
561 return &child->fwnode; 557 return &child->fwnode;
562 } 558 }