summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorIoana Ciornei <ioana.ciornei@nxp.com>2021-06-17 15:29:04 +0300
committerDavid S. Miller <davem@davemloft.net>2021-06-17 22:06:52 +0300
commit43e76d463c09a0272b84775bcc727c1eb8b384b2 (patch)
treef179f60a05928c1f4acbec49a972075afde2ddb0 /drivers/base
parent70ef608c224af39c7eee850d763b986954594de6 (diff)
downloadlinux-43e76d463c09a0272b84775bcc727c1eb8b384b2.tar.xz
driver core: add a helper to setup both the of_node and fwnode of a device
There are many places where both the fwnode_handle and the of_node of a device need to be populated. Add a function which does both so that we have consistency. Suggested-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 628e33939aca..b6836bfa985c 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -4723,6 +4723,13 @@ void device_set_of_node_from_dev(struct device *dev, const struct device *dev2)
}
EXPORT_SYMBOL_GPL(device_set_of_node_from_dev);
+void device_set_node(struct device *dev, struct fwnode_handle *fwnode)
+{
+ dev->fwnode = fwnode;
+ dev->of_node = to_of_node(fwnode);
+}
+EXPORT_SYMBOL_GPL(device_set_node);
+
int device_match_name(struct device *dev, const void *name)
{
return sysfs_streq(dev_name(dev), name);