Commit 86a1b633 authored by Scott Wood's avatar Scott Wood Committed by Paul Mackerras

[POWERPC] bootwrapper: Make ft_create_node() pay attention to the parent parameter.

Signed-off-by: default avatarScott Wood <scottwood@freescale.com>
Acked-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 8941c0c4
...@@ -961,19 +961,26 @@ int ft_del_prop(struct ft_cxt *cxt, const void *phandle, const char *propname) ...@@ -961,19 +961,26 @@ int ft_del_prop(struct ft_cxt *cxt, const void *phandle, const char *propname)
return -1; return -1;
} }
void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *path) void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *name)
{ {
struct ft_atom atom; struct ft_atom atom;
char *p, *next; char *p, *next;
int depth = 0; int depth = 0;
if (parent) {
p = ft_node_ph2node(cxt, parent);
if (!p)
return NULL;
} else {
p = ft_root_node(cxt); p = ft_root_node(cxt);
}
while ((next = ft_next(cxt, p, &atom)) != NULL) { while ((next = ft_next(cxt, p, &atom)) != NULL) {
switch (atom.tag) { switch (atom.tag) {
case OF_DT_BEGIN_NODE: case OF_DT_BEGIN_NODE:
++depth; ++depth;
if (depth == 1 && strcmp(atom.name, path) == 0) if (depth == 1 && strcmp(atom.name, name) == 0)
/* duplicate node path, return error */ /* duplicate node name, return error */
return NULL; return NULL;
break; break;
case OF_DT_END_NODE: case OF_DT_END_NODE:
...@@ -982,7 +989,7 @@ void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *path) ...@@ -982,7 +989,7 @@ void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *path)
break; break;
/* end of node, insert here */ /* end of node, insert here */
cxt->p = p; cxt->p = p;
ft_begin_node(cxt, path); ft_begin_node(cxt, name);
ft_end_node(cxt); ft_end_node(cxt);
return p; return p;
} }
......
...@@ -108,5 +108,6 @@ void *ft_get_parent(struct ft_cxt *cxt, const void *phandle); ...@@ -108,5 +108,6 @@ void *ft_get_parent(struct ft_cxt *cxt, const void *phandle);
void *ft_find_node_by_prop_value(struct ft_cxt *cxt, const void *prev, void *ft_find_node_by_prop_value(struct ft_cxt *cxt, const void *prev,
const char *propname, const char *propval, const char *propname, const char *propval,
int proplen); int proplen);
void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *name);
#endif /* FLATDEVTREE_H */ #endif /* FLATDEVTREE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment