summaryrefslogtreecommitdiffstats
path: root/include/linux/of.h
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2012-06-15 11:50:25 -0600
committerRob Herring <rob.herring@calxeda.com>2012-07-06 07:16:34 -0500
commit74a7f08448adea6cb47cd9b260c98ff168117e92 (patch)
treedf2ce1ae517e390d1049e01c1428a4b31fd689cc /include/linux/of.h
parent1af4c7f18a442771d86d496c761e9816349f98c9 (diff)
downloadlinux-74a7f08448adea6cb47cd9b260c98ff168117e92.tar.gz
linux-74a7f08448adea6cb47cd9b260c98ff168117e92.tar.bz2
linux-74a7f08448adea6cb47cd9b260c98ff168117e92.zip
devicetree: add helper inline for retrieving a node's full name
The pattern (np ? np->full_name : "<none>") is rather common in the kernel, but can also make for quite long lines. This patch adds a new inline function, of_node_full_name() so that the test for a valid node pointer doesn't need to be open coded at all call sites. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'include/linux/of.h')
-rw-r--r--include/linux/of.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index 2ec1083af7ff..1012377cae92 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -163,6 +163,11 @@ static inline int of_node_to_nid(struct device_node *np) { return -1; }
#define of_node_to_nid of_node_to_nid
#endif
+static inline const char* of_node_full_name(struct device_node *np)
+{
+ return np ? np->full_name : "<no-node>";
+}
+
extern struct device_node *of_find_node_by_name(struct device_node *from,
const char *name);
#define for_each_node_by_name(dn, name) \
@@ -303,6 +308,11 @@ const char *of_prop_next_string(struct property *prop, const char *cur);
#else /* CONFIG_OF */
+static inline const char* of_node_full_name(struct device_node *np)
+{
+ return "<no-node>";
+}
+
static inline bool of_have_populated_dt(void)
{
return false;