@@ -237,6 +237,29 @@ static void __fw_devlink_pickup_dangling_consumers(struct fwnode_handle *fwnode,
__fw_devlink_pickup_dangling_consumers(child, new_sup);
}
+
+void fw_devlink_fixup_new_fwnode(struct fwnode_handle *new_fwnode)
+{
+ struct fwnode_handle *parent;
+
+ if (new_fwnode->dev && new_fwnode->dev->bus)
+ return;
+
+ fwnode_for_each_parent_node(new_fwnode, parent)
+ if (parent->dev && parent->dev->bus)
+ break;
+
+ if (!parent)
+ return;
+
+ mutex_lock(&fwnode_link_lock);
+ __fw_devlink_pickup_dangling_consumers(new_fwnode, parent);
+ __fw_devlink_link_to_consumers(parent->dev);
+ mutex_unlock(&fwnode_link_lock);
+
+ fwnode_handle_put(parent);
+}
+
static DEFINE_MUTEX(device_links_lock);
DEFINE_STATIC_SRCU(device_links_srcu);
@@ -581,6 +581,7 @@ static int __of_changeset_entry_notify(struct of_changeset_entry *ce,
memset(&rd, 0, sizeof(rd));
rd.dn = ce->np;
ret = of_reconfig_notify(ce->action, &rd);
+ fw_devlink_fixup_new_fwnode(of_fwnode_handle(ce->np));
break;
case OF_RECONFIG_ADD_PROPERTY:
case OF_RECONFIG_REMOVE_PROPERTY:
@@ -220,6 +220,7 @@ int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup,
u8 flags);
void fwnode_links_purge(struct fwnode_handle *fwnode);
void fw_devlink_purge_absent_suppliers(struct fwnode_handle *fwnode);
+void fw_devlink_fixup_new_fwnode(struct fwnode_handle *new_fwnode);
bool fw_devlink_is_strict(void);
#endif
Get fw_devlink to work well with overlay devices. Signed-off-by: Saravana Kannan <saravanak@google.com> --- drivers/base/core.c | 23 +++++++++++++++++++++++ drivers/of/dynamic.c | 1 + include/linux/fwnode.h | 1 + 3 files changed, 25 insertions(+)