linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 14/19] bootwrapper: Make ft_create_node() pay attention to the parent parameter.
@ 2007-03-12 20:41 Scott Wood
  2007-03-13  2:27 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Scott Wood @ 2007-03-12 20:41 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/flatdevtree.c |   17 ++++++++++++-----
 arch/powerpc/boot/flatdevtree.h |    1 +
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index 97698a9..8b67745 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -965,19 +965,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:
@@ -986,7 +993,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;
 		}
diff --git a/arch/powerpc/boot/flatdevtree.h b/arch/powerpc/boot/flatdevtree.h
index e3e3e79..cb26325 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);
 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 */
-- 
1.5.0.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 14/19] bootwrapper: Make ft_create_node() pay attention to the parent parameter.
  2007-03-12 20:41 [PATCH 14/19] bootwrapper: Make ft_create_node() pay attention to the parent parameter Scott Wood
@ 2007-03-13  2:27 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2007-03-13  2:27 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Mon, Mar 12, 2007 at 02:41:59PM -0600, Scott Wood wrote:
> Signed-off-by: Scott Wood <scottwood@freescale.com>

Needs a commit comment, but modulo that.

Acked-by: David Gibson <david@gibson.dropbear.id.au>

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-03-13  2:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-12 20:41 [PATCH 14/19] bootwrapper: Make ft_create_node() pay attention to the parent parameter Scott Wood
2007-03-13  2:27 ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).