summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorSaravana Kannan <saravanak@google.com>2020-11-20 18:02:27 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-12-09 19:10:21 +0100
commitc2c724c868c42c5166bf7aa644dd0a0c8d30b47a (patch)
treebf50ae352978d0d8d732cef916af46e50ddb9256 /drivers/base
parent04f63c213b671d89db35f4239f57fa1edeb736a8 (diff)
driver core: Add fw_devlink_parse_fwtree()
This function is a wrapper around fwnode_operations.add_links(). This function parses each node in a fwnode tree and create fwnode links for each of those nodes. The information for creating the fwnode links (the supplier and consumer fwnode) is obtained by parsing the properties in each of the fwnodes. This function also ensures that no fwnode is parsed more than once by marking the fwnodes as parsed. Signed-off-by: Saravana Kannan <saravanak@google.com> Link: https://lore.kernel.org/r/20201121020232.908850-13-saravanak@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index edde79fc3d33..92a2dc355d13 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1542,6 +1542,25 @@ static bool fw_devlink_is_permissive(void)
return fw_devlink_flags == DL_FLAG_SYNC_STATE_ONLY;
}
+static void fw_devlink_parse_fwnode(struct fwnode_handle *fwnode)
+{
+ if (fwnode->flags & FWNODE_FLAG_LINKS_ADDED)
+ return;
+
+ fwnode_call_int_op(fwnode, add_links, NULL);
+ fwnode->flags |= FWNODE_FLAG_LINKS_ADDED;
+}
+
+static void fw_devlink_parse_fwtree(struct fwnode_handle *fwnode)
+{
+ struct fwnode_handle *child = NULL;
+
+ fw_devlink_parse_fwnode(fwnode);
+
+ while ((child = fwnode_get_next_available_child_node(fwnode, child)))
+ fw_devlink_parse_fwtree(child);
+}
+
static void fw_devlink_link_device(struct device *dev)
{
int fw_ret;