aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/pdt.c
diff options
context:
space:
mode:
authorPantelis Antoniou <panto@antoniou-consulting.com>2013-12-13 13:08:59 -0500
committerGrant Likely <grant.likely@linaro.org>2014-03-19 10:58:40 -0400
commit0829f6d1f69e4f2fae4062987ae6531a9af1a2e3 (patch)
tree4081a4bee4a9e193b4de690735b5a3782d100eac /drivers/of/pdt.c
parent8357041a69b368991d1b04d9f1d297f8d71e1314 (diff)
of: device_node kobject lifecycle fixes
After the move to having device nodes be proper kobjects the lifecycle of the node needs to be controlled better. At first convert of_add_node() in the unflattened functions to of_init_node() which initializes the kobject so that of_node_get/put work correctly even before of_init is called. Afterwards introduce of_node_is_initialized & of_node_is_attached that query the underlying kobject about the state (attached means kobj is visible in sysfs) Using that make sure the lifecycle of the tree is correct at all times. Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com> [grant.likely: moved of_node_init() calls, fixed up locking, and dropped __of_populate() hunks] Signed-off-by: Grant Likely <grant.likely@linaro.org>
Diffstat (limited to 'drivers/of/pdt.c')
-rw-r--r--drivers/of/pdt.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/of/pdt.c b/drivers/of/pdt.c
index e64fa3d3da5f..36b4035881b0 100644
--- a/drivers/of/pdt.c
+++ b/drivers/of/pdt.c
@@ -176,6 +176,7 @@ static struct device_node * __init of_pdt_create_node(phandle node,
176 return NULL; 176 return NULL;
177 177
178 dp = prom_early_alloc(sizeof(*dp)); 178 dp = prom_early_alloc(sizeof(*dp));
179 of_node_init(dp);
179 of_pdt_incr_unique_id(dp); 180 of_pdt_incr_unique_id(dp);
180 dp->parent = parent; 181 dp->parent = parent;
181 182
@@ -213,7 +214,6 @@ static struct device_node * __init of_pdt_build_tree(struct device_node *parent,
213 *nextp = &dp->allnext; 214 *nextp = &dp->allnext;
214 215
215 dp->full_name = of_pdt_build_full_name(dp); 216 dp->full_name = of_pdt_build_full_name(dp);
216 of_node_add(dp);
217 217
218 dp->child = of_pdt_build_tree(dp, 218 dp->child = of_pdt_build_tree(dp,
219 of_pdt_prom_ops->getchild(node), nextp); 219 of_pdt_prom_ops->getchild(node), nextp);
@@ -244,7 +244,6 @@ void __init of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops)
244 of_allnodes->path_component_name = ""; 244 of_allnodes->path_component_name = "";
245#endif 245#endif
246 of_allnodes->full_name = "/"; 246 of_allnodes->full_name = "/";
247 of_node_add(of_allnodes);
248 247
249 nextp = &of_allnodes->allnext; 248 nextp = &of_allnodes->allnext;
250 of_allnodes->child = of_pdt_build_tree(of_allnodes, 249 of_allnodes->child = of_pdt_build_tree(of_allnodes,