[PATCH v2 7/8] swnode: fix software_node_notify() primary node comment

From: Johan Hovold

Date: Tue Nov 10 2026 - 03:55:53 EST


The firmware node pointer in struct device may point to either a primary
or a secondary firmware node and driver core sets the dev pointer of
that node when registering devices.

Fix the comments in software_node_notify() and
software_node_notify_remove() which incorrectly suggest that driver
core only sets the dev pointer of primary firmware nodes.

Fixes: 37e586675993 ("software node: add fw_devlink support")
Cc: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
Signed-off-by: Johan Hovold <johan@xxxxxxxxxx>
---
drivers/base/swnode.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
index a90c20cb84e6..8e12f518e13f 100644
--- a/drivers/base/swnode.c
+++ b/drivers/base/swnode.c
@@ -1169,8 +1169,8 @@ void software_node_notify(struct device *dev)
return;

/*
- * When the software node is the device's secondary firmware node,
- * the core only records the owning device on the primary fwnode
+ * When a device has both a primary and a secondary firmware node the
+ * core only records the owning device in the primary node
* (see device_add()). fw_devlink resolves a supplier device through
* fwnode->dev, so without this a consumer referencing the software
* node could never find the supplier device and would defer forever.
@@ -1205,9 +1205,8 @@ void software_node_notify_remove(struct device *dev)
sysfs_remove_link(&dev->kobj, "software_node");

/*
- * Drop the device pointer mirrored onto a secondary software node in
- * software_node_notify(). For a primary software node the core owns
- * fwnode->dev and clears it in device_del().
+ * Clear any device pointer set in a secondary software node in
+ * software_node_notify().
*/
if (!device_match_fwnode(dev, &swnode->fwnode) && swnode->fwnode.dev == dev)
swnode->fwnode.dev = NULL;
--
2.56.0