summaryrefslogtreecommitdiffstats
path: root/drivers/of/pdt.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@linaro.org>2014-02-20 13:02:11 -0500
committerGrant Likely <grant.likely@linaro.org>2014-03-11 16:48:26 -0400
commit75b57ecf9d1d1e17d099ab13b8f48e6e038676be (patch)
tree1fcf03dae1722cf5c7917023a404958be2bce036 /drivers/of/pdt.c
parentdab2310d9d90eded48625c5382c6a60389bf8ca9 (diff)
of: Make device nodes kobjects so they show up in sysfs
Device tree nodes are already treated as objects, and we already want to expose them to userspace which is done using the /proc filesystem today. Right now the kernel has to do a lot of work to keep the /proc view in sync with the in-kernel representation. If device_nodes are switched to be kobjects then the device tree code can be a whole lot simpler. It also turns out that switching to using /sysfs from /proc results in smaller code and data size, and the userspace ABI won't change if /proc/device-tree symlinks to /sys/firmware/devicetree/base. v7: Add missing sysfs_bin_attr_init() v6: Add __of_add_property() early init fixes from Pantelis v5: Rename firmware/ofw to firmware/devicetree Fix updating property values in sysfs v4: Fixed build error on Powerpc Fixed handling of dynamic nodes on powerpc v3: Fixed handling of duplicate attribute and child node names v2: switch to using sysfs bin_attributes which solve the problem of reporting incorrect property size. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Tested-by: Sascha Hauer <s.hauer@pengutronix.de> Cc: Rob Herring <rob.herring@calxeda.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: David S. Miller <davem@davemloft.net> Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
Diffstat (limited to 'drivers/of/pdt.c')
-rw-r--r--drivers/of/pdt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/of/pdt.c b/drivers/of/pdt.c
index 7b666736c168..e64fa3d3da5f 100644
--- a/drivers/of/pdt.c
+++ b/drivers/of/pdt.c
@@ -179,8 +179,6 @@ static struct device_node * __init of_pdt_create_node(phandle node,
179 of_pdt_incr_unique_id(dp); 179 of_pdt_incr_unique_id(dp);
180 dp->parent = parent; 180 dp->parent = parent;
181 181
182 kref_init(&dp->kref);
183
184 dp->name = of_pdt_get_one_property(node, "name"); 182 dp->name = of_pdt_get_one_property(node, "name");
185 dp->type = of_pdt_get_one_property(node, "device_type"); 183 dp->type = of_pdt_get_one_property(node, "device_type");
186 dp->phandle = node; 184 dp->phandle = node;
@@ -215,6 +213,7 @@ static struct device_node * __init of_pdt_build_tree(struct device_node *parent,
215 *nextp = &dp->allnext; 213 *nextp = &dp->allnext;
216 214
217 dp->full_name = of_pdt_build_full_name(dp); 215 dp->full_name = of_pdt_build_full_name(dp);
216 of_node_add(dp);
218 217
219 dp->child = of_pdt_build_tree(dp, 218 dp->child = of_pdt_build_tree(dp,
220 of_pdt_prom_ops->getchild(node), nextp); 219 of_pdt_prom_ops->getchild(node), nextp);
@@ -245,6 +244,7 @@ void __init of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops)
245 of_allnodes->path_component_name = ""; 244 of_allnodes->path_component_name = "";
246#endif 245#endif
247 of_allnodes->full_name = "/"; 246 of_allnodes->full_name = "/";
247 of_node_add(of_allnodes);
248 248
249 nextp = &of_allnodes->allnext; 249 nextp = &of_allnodes->allnext;
250 of_allnodes->child = of_pdt_build_tree(of_allnodes, 250 of_allnodes->child = of_pdt_build_tree(of_allnodes,