@@ -542,3 +542,18 @@ struct fwnode_handle *fwnode_get_parent(struct fwnode_handle *fwnode)
return NULL;
}
EXPORT_SYMBOL_GPL(fwnode_get_parent);
+
+/**
+ * fwnode_get_name - return the name of a device node
+ * @fwnode: Device node to find the name of
+ */
+const char *fwnode_get_name(struct fwnode_handle *fwnode)
+{
+ if (is_of_node(fwnode))
+ return of_node(fwnode)->full_name;
+ else if (is_acpi_node(fwnode))
+ return acpi_dev_name(acpi_node(fwnode));
+
+ return NULL;
+}
+EXPORT_SYMBOL_GPL(fwnode_get_name);
@@ -65,6 +65,8 @@ struct fwnode_handle *device_get_next_child_node(struct device *dev,
struct fwnode_handle *fwnode_get_parent(struct fwnode_handle *fwnode);
+const char *fwnode_get_name(struct fwnode_handle *fwnode);
+
#define device_for_each_child_node(dev, child) \
for (child = device_get_next_child_node(dev, NULL); child; \
child = device_get_next_child_node(dev, child))
Getting a textual representation of a device node can be very useful for debugging. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> --- drivers/base/property.c | 15 +++++++++++++++ include/linux/property.h | 2 ++ 2 files changed, 17 insertions(+)