[PATCH v7 1/8] driver core: fw_devlink: Introduce fw_devlink_set_device()

From: Herve Codina

Date: Mon May 11 2026 - 12:41:11 EST


Setting fwnode->dev is specific to fw_devlink.

In order to avoid having a direct 'fwnode->dev = dev;' in several
place in the kernel, introduce fw_devlink_set_device() helper to perform
this operation.

Having this helper allows to hide the fwnode devlink related stuff
behind the helper.

Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Herve Codina <herve.codina@xxxxxxxxxxx>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Reviewed-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
Reviewed-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
---
Cc stable because used by other patches with Fixes + Cc stable
---
include/linux/fwnode.h | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index 80b38fbf2121..b005bd78a379 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -252,4 +252,10 @@ void fwnode_links_purge(struct fwnode_handle *fwnode);
void fw_devlink_purge_absent_suppliers(struct fwnode_handle *fwnode);
bool fw_devlink_is_strict(void);

+static inline void fw_devlink_set_device(struct fwnode_handle *fwnode,
+ struct device *dev)
+{
+ fwnode->dev = dev;
+}
+
#endif
--
2.54.0