@@ -237,6 +237,16 @@ static void __fw_devlink_pickup_dangling_consumers(struct fwnode_handle *fwnode,
__fw_devlink_pickup_dangling_consumers(child, new_sup);
}
+
+void fw_devlink_pickup_dangling_consumers(struct fwnode_handle *child,
+ struct fwnode_handle *parent)
+{
+ mutex_lock(&fwnode_link_lock);
+ __fw_devlink_pickup_dangling_consumers(child, parent);
+ __fw_devlink_link_to_consumers(parent->dev);
+ mutex_unlock(&fwnode_link_lock);
+}
+
static DEFINE_MUTEX(device_links_lock);
DEFINE_STATIC_SRCU(device_links_srcu);
@@ -237,6 +237,7 @@ static void __of_attach_node(struct device_node *np)
int of_attach_node(struct device_node *np)
{
struct of_reconfig_data rd;
+ struct fwnode_handle *fwnode, *parent;
memset(&rd, 0, sizeof(rd));
rd.dn = np;
@@ -246,6 +247,13 @@ int of_attach_node(struct device_node *np)
mutex_unlock(&of_mutex);
of_reconfig_notify(OF_RECONFIG_ATTACH_NODE, &rd);
+ fwnode = of_fwnode_handle(np);
+ fwnode_for_each_parent_node(fwnode, parent)
+ if (parent->dev) {
+ fw_devlink_pickup_dangling_consumers(fwnode, parent);
+ fwnode_handle_put(parent);
+ break;
+ }
return 0;
}
@@ -220,6 +220,8 @@ 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_pickup_dangling_consumers(struct fwnode_handle *child,
+ struct fwnode_handle *parent);
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 | 10 ++++++++++ drivers/of/dynamic.c | 8 ++++++++ include/linux/fwnode.h | 2 ++ 3 files changed, 20 insertions(+)