[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1434548543-22949-13-git-send-email-tomeu.vizoso@collabora.com>
Date: Wed, 17 Jun 2015 15:42:22 +0200
From: Tomeu Vizoso <tomeu.vizoso@...labora.com>
To: linux-arm-kernel@...ts.infradead.org
Cc: Tomeu Vizoso <tomeu.vizoso@...labora.com>,
Alexander Holler <holler@...oftware.de>,
Alexandre Courbot <gnurou@...il.com>,
Andrzej Hajda <a.hajda@...sung.com>,
Arnd Bergmann <arnd@...db.de>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Grant Likely <grant.likely@...aro.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ian Campbell <ijc+devicetree@...lion.org.uk>,
Javier Martinez Canillas <javier.martinez@...labora.co.uk>,
Krzysztof Kozlowski <k.kozlowski@...sung.com>,
Kumar Gala <galak@...eaurora.org>, Len Brown <lenb@...nel.org>,
Linus Walleij <linus.walleij@...aro.org>,
linux-kernel@...r.kernel.org, Lv Zheng <lv.zheng@...el.com>,
Mark Brown <broonie@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Pawel Moll <pawel.moll@....com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Robert Moore <robert.moore@...el.com>,
Rob Herring <robh+dt@...nel.org>,
Russell King <linux@....linux.org.uk>,
Stephen Warren <swarren@...dotorg.org>,
Terje Bergström <tbergstrom@...dia.com>,
Thierry Reding <thierry.reding@...il.com>
Subject: [PATCH 12/13] device property: add fwnode_get_name()
Getting a textual representation of a device node can be very useful for
debugging.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@...labora.com>
---
drivers/base/property.c | 15 +++++++++++++++
include/linux/property.h | 2 ++
2 files changed, 17 insertions(+)
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 28645a9..05e45f8 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -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);
diff --git a/include/linux/property.h b/include/linux/property.h
index 01e0483..7b7c0e8 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -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))
--
2.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists