diff options
author | Pantelis Antoniou <panto@antoniou-consulting.com> | 2013-12-13 18:08:59 (GMT) |
---|---|---|
committer | Grant Likely <grant.likely@linaro.org> | 2014-03-19 14:58:40 (GMT) |
commit | 0829f6d1f69e4f2fae4062987ae6531a9af1a2e3 (patch) | |
tree | 4081a4bee4a9e193b4de690735b5a3782d100eac /drivers/of/fdt.c | |
parent | 8357041a69b368991d1b04d9f1d297f8d71e1314 (diff) | |
download | linux-0829f6d1f69e4f2fae4062987ae6531a9af1a2e3.tar.xz |
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/fdt.c')
-rw-r--r-- | drivers/of/fdt.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 96ad1ab..70ccc36 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -202,6 +202,7 @@ static void * unflatten_dt_node(struct boot_param_header *blob, __alignof__(struct device_node)); if (allnextpp) { char *fn; + of_node_init(np); np->full_name = fn = ((char *)np) + sizeof(*np); if (new_format) { /* rebuild full path for new format */ @@ -326,8 +327,6 @@ static void * unflatten_dt_node(struct boot_param_header *blob, np->name = "<NULL>"; if (!np->type) np->type = "<NULL>"; - - of_node_add(np); } while (tag == OF_DT_BEGIN_NODE || tag == OF_DT_NOP) { if (tag == OF_DT_NOP) |