aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2017-10-04 15:04:01 -0400
committerRob Herring <robh@kernel.org>2017-10-16 14:37:38 -0400
commit0c3c234b95fa7f1dfa19e1456a47ebafc300dd6b (patch)
treebd88c75e9101be4897e70d8e990b400776c69638
parent4c2bb57400394e4ec631a42dcf637e925db6202e (diff)
of: wrap accesses to device_node kobject
In preparation to make kobject element in struct device_node optional, provide and use a macro to return the kobject pointer. The only user outside the DT core is the driver core. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Tested-by: Nicolas Pitre <nico@linaro.org> Reviewed-by: Frank Rowand <frowand.list@gmail.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Rob Herring <robh@kernel.org>
-rw-r--r--drivers/base/core.c2
-rw-r--r--include/linux/of.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 12ebd055724c..c07b47059538 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1571,7 +1571,7 @@ static int device_add_class_symlinks(struct device *dev)
1571 int error; 1571 int error;
1572 1572
1573 if (of_node) { 1573 if (of_node) {
1574 error = sysfs_create_link(&dev->kobj, &of_node->kobj,"of_node"); 1574 error = sysfs_create_link(&dev->kobj, of_node_kobj(of_node), "of_node");
1575 if (error) 1575 if (error)
1576 dev_warn(dev, "Error %d creating of_node link\n",error); 1576 dev_warn(dev, "Error %d creating of_node link\n",error);
1577 /* An error here doesn't warrant bringing down the device */ 1577 /* An error here doesn't warrant bringing down the device */
diff --git a/include/linux/of.h b/include/linux/of.h
index 7eb94b7fbcf3..2d685e769409 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -111,6 +111,8 @@ static inline void of_node_init(struct device_node *node)
111 node->fwnode.ops = &of_fwnode_ops; 111 node->fwnode.ops = &of_fwnode_ops;
112} 112}
113 113
114#define of_node_kobj(n) (&(n)->kobj)
115
114/* true when node is initialized */ 116/* true when node is initialized */
115static inline int of_node_is_initialized(struct device_node *node) 117static inline int of_node_is_initialized(struct device_node *node)
116{ 118{