diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2012-06-15 11:50:25 -0600 |
---|---|---|
committer | Rob Herring <rob.herring@calxeda.com> | 2012-07-06 07:16:34 -0500 |
commit | 74a7f08448adea6cb47cd9b260c98ff168117e92 (patch) | |
tree | df2ce1ae517e390d1049e01c1428a4b31fd689cc /arch/powerpc/kernel/vio.c | |
parent | 1af4c7f18a442771d86d496c761e9816349f98c9 (diff) | |
download | linux-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 'arch/powerpc/kernel/vio.c')
-rw-r--r-- | arch/powerpc/kernel/vio.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c index cb87301ccd55..63f72ede4341 100644 --- a/arch/powerpc/kernel/vio.c +++ b/arch/powerpc/kernel/vio.c @@ -1296,8 +1296,7 @@ static void __devinit vio_dev_release(struct device *dev) struct iommu_table *tbl = get_iommu_table_base(dev); if (tbl) - iommu_free_table(tbl, dev->of_node ? - dev->of_node->full_name : dev_name(dev)); + iommu_free_table(tbl, of_node_full_name(dev->of_node)); of_node_put(dev->of_node); kfree(to_vio_dev(dev)); } @@ -1509,7 +1508,7 @@ static ssize_t devspec_show(struct device *dev, { struct device_node *of_node = dev->of_node; - return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none"); + return sprintf(buf, "%s\n", of_node_full_name(of_node)); } static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, |