[POWERPC] bootwrapper: Make ft_create_node() pay attention to the parent parameter.
authorScott Wood <scottwood@freescale.com>
Mon, 12 Mar 2007 20:41:59 +0000 (14:41 -0600)
committerPaul Mackerras <paulus@samba.org>
Fri, 16 Mar 2007 04:49:15 +0000 (15:49 +1100)
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>
arch/powerpc/boot/flatdevtree.c
arch/powerpc/boot/flatdevtree.h

index f6e37c2ee4dd04cc51851cbdbdd637a0b184c7e6..d00fbd92a4585819cf7b4da042d325c4a3d187c4 100644 (file)
@@ -961,19 +961,26 @@ int ft_del_prop(struct ft_cxt *cxt, const void *phandle, const char *propname)
        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;
        char *p, *next;
        int depth = 0;
 
-       p = ft_root_node(cxt);
+       if (parent) {
+               p = ft_node_ph2node(cxt, parent);
+               if (!p)
+                       return NULL;
+       } else {
+               p = ft_root_node(cxt);
+       }
+
        while ((next = ft_next(cxt, p, &atom)) != NULL) {
                switch (atom.tag) {
                case OF_DT_BEGIN_NODE:
                        ++depth;
-                       if (depth == 1 && strcmp(atom.name, path) == 0)
-                               /* duplicate node path, return error */
+                       if (depth == 1 && strcmp(atom.name, name) == 0)
+                               /* duplicate node name, return error */
                                return NULL;
                        break;
                case OF_DT_END_NODE:
@@ -982,7 +989,7 @@ void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *path)
                                break;
                        /* end of node, insert here */
                        cxt->p = p;
-                       ft_begin_node(cxt, path);
+                       ft_begin_node(cxt, name);
                        ft_end_node(cxt);
                        return p;
                }
index e3e3e79937ffeb582e83553e1f1ea7c86a82e984..cb26325d72db9cc84562199819af862f0f2ec76c 100644 (file)
@@ -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,
                                  const char *propname, const char *propval,
                                  int proplen);
+void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *name);
 
 #endif /* FLATDEVTREE_H */