aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2007-03-12 16:41:59 -0400
committerPaul Mackerras <paulus@samba.org>2007-03-16 00:49:15 -0400
commit86a1b63349bb2cbed6c2cbf8f9e9de9259a404df (patch)
treea4fbdff5b1fcf7b0cd63f01e378644db4bc0a410 /arch
parent8941c0c495e8765206ec1017b1e069ce41bf6e8f (diff)
[POWERPC] bootwrapper: Make ft_create_node() pay attention to the parent parameter.
Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/boot/flatdevtree.c17
-rw-r--r--arch/powerpc/boot/flatdevtree.h1
2 files changed, 13 insertions, 5 deletions
diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index f6e37c2ee4dd..d00fbd92a458 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -961,19 +961,26 @@ int ft_del_prop(struct ft_cxt *cxt, const void *phandle, const char *propname)
961 return -1; 961 return -1;
962} 962}
963 963
964void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *path) 964void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *name)
965{ 965{
966 struct ft_atom atom; 966 struct ft_atom atom;
967 char *p, *next; 967 char *p, *next;
968 int depth = 0; 968 int depth = 0;
969 969
970 p = ft_root_node(cxt); 970 if (parent) {
971 p = ft_node_ph2node(cxt, parent);
972 if (!p)
973 return NULL;
974 } else {
975 p = ft_root_node(cxt);
976 }
977
971 while ((next = ft_next(cxt, p, &atom)) != NULL) { 978 while ((next = ft_next(cxt, p, &atom)) != NULL) {
972 switch (atom.tag) { 979 switch (atom.tag) {
973 case OF_DT_BEGIN_NODE: 980 case OF_DT_BEGIN_NODE:
974 ++depth; 981 ++depth;
975 if (depth == 1 && strcmp(atom.name, path) == 0) 982 if (depth == 1 && strcmp(atom.name, name) == 0)
976 /* duplicate node path, return error */ 983 /* duplicate node name, return error */
977 return NULL; 984 return NULL;
978 break; 985 break;
979 case OF_DT_END_NODE: 986 case OF_DT_END_NODE:
@@ -982,7 +989,7 @@ void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *path)
982 break; 989 break;
983 /* end of node, insert here */ 990 /* end of node, insert here */
984 cxt->p = p; 991 cxt->p = p;
985 ft_begin_node(cxt, path); 992 ft_begin_node(cxt, name);
986 ft_end_node(cxt); 993 ft_end_node(cxt);
987 return p; 994 return p;
988 } 995 }
diff --git a/arch/powerpc/boot/flatdevtree.h b/arch/powerpc/boot/flatdevtree.h
index e3e3e79937ff..cb26325d72db 100644
--- a/arch/powerpc/boot/flatdevtree.h
+++ b/arch/powerpc/boot/flatdevtree.h
@@ -108,5 +108,6 @@ void *ft_get_parent(struct ft_cxt *cxt, const void *phandle);
108void *ft_find_node_by_prop_value(struct ft_cxt *cxt, const void *prev, 108void *ft_find_node_by_prop_value(struct ft_cxt *cxt, const void *prev,
109 const char *propname, const char *propval, 109 const char *propname, const char *propval,
110 int proplen); 110 int proplen);
111void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *name);
111 112
112#endif /* FLATDEVTREE_H */ 113#endif /* FLATDEVTREE_H */