aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2007-03-12 16:41:42 -0400
committerPaul Mackerras <paulus@samba.org>2007-03-13 06:15:44 -0400
commit7c71c04625483c1da91846fd6746057d24ad6be8 (patch)
tree7cf4ae6e3e450ae387054fa06c8d7b4b3949d650 /arch/powerpc/boot
parentce3edb30ec2b6350c4258e3d52e73b410e2ea12d (diff)
[POWERPC] bootwrapper: Add ft_root_node().
Clean up some of the open-coded data structure references by providing a function to return a pointer to the tree's root node. This is only used in high-level functions trying to access the root of the tree, not in low-level code that is actually manipulating the data structure. Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: Mark A. Greer <mgreer@mvista.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/boot')
-rw-r--r--arch/powerpc/boot/flatdevtree.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index c76c194715b2..02823a868b95 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -29,6 +29,11 @@
29 29
30#define _ALIGN(x, al) (((x) + (al) - 1) & ~((al) - 1)) 30#define _ALIGN(x, al) (((x) + (al) - 1) & ~((al) - 1))
31 31
32static char *ft_root_node(struct ft_cxt *cxt)
33{
34 return cxt->rgn[FT_STRUCT].start;
35}
36
32/* Routines for keeping node ptrs returned by ft_find_device current */ 37/* Routines for keeping node ptrs returned by ft_find_device current */
33/* First entry not used b/c it would return 0 and be taken as NULL/error */ 38/* First entry not used b/c it would return 0 and be taken as NULL/error */
34static void *ft_node_add(struct ft_cxt *cxt, char *node) 39static void *ft_node_add(struct ft_cxt *cxt, char *node)
@@ -590,7 +595,7 @@ int ft_add_rsvmap(struct ft_cxt *cxt, u64 physaddr, u64 size)
590 595
591void ft_begin_tree(struct ft_cxt *cxt) 596void ft_begin_tree(struct ft_cxt *cxt)
592{ 597{
593 cxt->p = cxt->rgn[FT_STRUCT].start; 598 cxt->p = ft_root_node(cxt);
594} 599}
595 600
596void ft_end_tree(struct ft_cxt *cxt) 601void ft_end_tree(struct ft_cxt *cxt)
@@ -636,7 +641,7 @@ void *ft_find_device(struct ft_cxt *cxt, const char *srch_path)
636 /* require absolute path */ 641 /* require absolute path */
637 if (srch_path[0] != '/') 642 if (srch_path[0] != '/')
638 return NULL; 643 return NULL;
639 node = ft_find_descendent(cxt, cxt->rgn[FT_STRUCT].start, srch_path); 644 node = ft_find_descendent(cxt, ft_root_node(cxt), srch_path);
640 return ft_node_add(cxt, node); 645 return ft_node_add(cxt, node);
641} 646}
642 647
@@ -717,7 +722,7 @@ void *ft_get_parent(struct ft_cxt *cxt, const void *phandle)
717 return cxt->genealogy[d > 0 ? d - 1 : 0]; 722 return cxt->genealogy[d > 0 ? d - 1 : 0];
718 723
719 /* have to do it the hard way... */ 724 /* have to do it the hard way... */
720 p = cxt->rgn[FT_STRUCT].start; 725 p = ft_root_node(cxt);
721 d = 0; 726 d = 0;
722 while ((p = ft_next(cxt, p, &atom)) != NULL) { 727 while ((p = ft_next(cxt, p, &atom)) != NULL) {
723 switch (atom.tag) { 728 switch (atom.tag) {
@@ -855,7 +860,7 @@ void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *path)
855 char *p, *next; 860 char *p, *next;
856 int depth = 0; 861 int depth = 0;
857 862
858 p = cxt->rgn[FT_STRUCT].start; 863 p = ft_root_node(cxt);
859 while ((next = ft_next(cxt, p, &atom)) != NULL) { 864 while ((next = ft_next(cxt, p, &atom)) != NULL) {
860 switch (atom.tag) { 865 switch (atom.tag) {
861 case OF_DT_BEGIN_NODE: 866 case OF_DT_BEGIN_NODE: