From: Saravana Kannan <saravanak@google.com>
To: Herve Codina <herve.codina@bootlin.com>,
Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Saravana Kannan <saravanak@google.com>,
Rob Herring <robh@kernel.org>,
kernel-team@android.com, linux-kernel@vger.kernel.org,
imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-i2c@vger.kernel.org, devicetree@vger.kernel.org,
linux-spi@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: [RFC PATCH v2 2/2] of: dynamic: Fix probing of overlay devices
Date: Mon, 8 Apr 2024 22:37:03 -0700 [thread overview]
Message-ID: <20240409053704.428336-3-saravanak@google.com> (raw)
In-Reply-To: <20240409053704.428336-1-saravanak@google.com>
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(+)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 5f4e03336e68..5ce33dbd7560 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -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);
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 19a1a38554f2..a2ad79ea9a06 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -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:
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index 0d79070c5a70..230aeccef6f3 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -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
--
2.44.0.478.gd926399ef9-goog
next prev parent reply other threads:[~2024-04-09 5:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-09 5:37 [RFC PATCH v2 0/2] fw_devlink overlay fix Saravana Kannan
2024-04-09 5:37 ` [RFC PATCH v2 1/2] Revert "treewide: Fix probing of devices in DT overlays" Saravana Kannan
2024-04-09 13:14 ` Rob Herring
2024-04-09 5:37 ` Saravana Kannan [this message]
2024-04-09 13:02 ` [RFC PATCH v2 0/2] fw_devlink overlay fix Herve Codina
2024-04-10 1:06 ` Saravana Kannan
2024-04-10 12:35 ` Herve Codina
2024-04-09 15:10 ` Geert Uytterhoeven
2024-04-10 0:41 ` Saravana Kannan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240409053704.428336-3-saravanak@google.com \
--to=saravanak@google.com \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=herve.codina@bootlin.com \
--cc=imx@lists.linux.dev \
--cc=kernel-team@android.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox