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>
This commit is contained in:

committed by
Grant Likely

parent
8357041a69
commit
0829f6d1f6
@@ -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)
|
||||
|
Reference in New Issue
Block a user