* [PATCH 05/18] Add ft_first_node().
@ 2007-01-24 21:07 Scott Wood
2007-01-24 21:31 ` Jerry Van Baren
2007-01-24 21:46 ` Segher Boessenkool
0 siblings, 2 replies; 5+ messages in thread
From: Scott Wood @ 2007-01-24 21:07 UTC (permalink / raw)
To: linuxppc-dev
Clean up some of the open-coded data structure references by providing a
function to return a pointer to the first node in the tree. This is only
used in high-level functions trying to access the beginning of the tree,
not in low-level code that is actually manipulating the data structure.
Signed-off-by: Scott Wood <scottwood@freescale.com>
---
arch/powerpc/boot/flatdevtree.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index c76c194..78e179f 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -29,6 +29,11 @@
#define _ALIGN(x, al) (((x) + (al) - 1) & ~((al) - 1))
+static char *ft_first_node(struct ft_cxt *cxt)
+{
+ return cxt->rgn[FT_STRUCT].start;
+}
+
/* Routines for keeping node ptrs returned by ft_find_device current */
/* First entry not used b/c it would return 0 and be taken as NULL/error */
static void *ft_node_add(struct ft_cxt *cxt, char *node)
@@ -590,7 +595,7 @@ int ft_add_rsvmap(struct ft_cxt *cxt, u6
void ft_begin_tree(struct ft_cxt *cxt)
{
- cxt->p = cxt->rgn[FT_STRUCT].start;
+ cxt->p = ft_first_node(cxt);
}
void ft_end_tree(struct ft_cxt *cxt)
@@ -636,7 +641,7 @@ void *ft_find_device(struct ft_cxt *cxt,
/* require absolute path */
if (srch_path[0] != '/')
return NULL;
- node = ft_find_descendent(cxt, cxt->rgn[FT_STRUCT].start, srch_path);
+ node = ft_find_descendent(cxt, ft_first_node(cxt), srch_path);
return ft_node_add(cxt, node);
}
@@ -717,7 +722,7 @@ void *ft_get_parent(struct ft_cxt *cxt,
return cxt->genealogy[d > 0 ? d - 1 : 0];
/* have to do it the hard way... */
- p = cxt->rgn[FT_STRUCT].start;
+ p = ft_first_node(cxt);
d = 0;
while ((p = ft_next(cxt, p, &atom)) != NULL) {
switch (atom.tag) {
@@ -855,7 +860,7 @@ void *ft_create_node(struct ft_cxt *cxt,
char *p, *next;
int depth = 0;
- p = cxt->rgn[FT_STRUCT].start;
+ p = ft_first_node(cxt);
while ((next = ft_next(cxt, p, &atom)) != NULL) {
switch (atom.tag) {
case OF_DT_BEGIN_NODE:
--
1.4.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 05/18] Add ft_first_node().
2007-01-24 21:07 [PATCH 05/18] Add ft_first_node() Scott Wood
@ 2007-01-24 21:31 ` Jerry Van Baren
2007-01-24 21:59 ` Scott Wood
2007-01-24 21:46 ` Segher Boessenkool
1 sibling, 1 reply; 5+ messages in thread
From: Jerry Van Baren @ 2007-01-24 21:31 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
Scott Wood wrote:
> Clean up some of the open-coded data structure references by providing a
> function to return a pointer to the first node in the tree. This is only
> used in high-level functions trying to access the beginning of the tree,
> not in low-level code that is actually manipulating the data structure.
>
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---
> arch/powerpc/boot/flatdevtree.c | 13 +++++++++----
> 1 files changed, 9 insertions(+), 4 deletions(-)
Hi Scott,
Have you considered replacing flatdevtree.c with David Gibson's fdtlib?
The interface is a lot cleaner, which likely carries through to the
underlying code.
<http://thread.gmane.org/gmane.linux.ports.ppc64.devel/12771/focus=12877>
Best regards,
gvb
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 05/18] Add ft_first_node().
2007-01-24 21:07 [PATCH 05/18] Add ft_first_node() Scott Wood
2007-01-24 21:31 ` Jerry Van Baren
@ 2007-01-24 21:46 ` Segher Boessenkool
1 sibling, 0 replies; 5+ messages in thread
From: Segher Boessenkool @ 2007-01-24 21:46 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
> +static char *ft_first_node(struct ft_cxt *cxt)
> +{
> + return cxt->rgn[FT_STRUCT].start;
> +}
Probably should be ft_root_node() instead? Looks
fine otherwise (obviously ;-) )
Segher
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 05/18] Add ft_first_node().
2007-01-24 21:31 ` Jerry Van Baren
@ 2007-01-24 21:59 ` Scott Wood
2007-01-24 23:37 ` David Gibson
0 siblings, 1 reply; 5+ messages in thread
From: Scott Wood @ 2007-01-24 21:59 UTC (permalink / raw)
To: Jerry Van Baren; +Cc: linuxppc-dev
Jerry Van Baren wrote:
> Have you considered replacing flatdevtree.c with David Gibson's fdtlib?
> The interface is a lot cleaner, which likely carries through to the
> underlying code.
> <http://thread.gmane.org/gmane.linux.ports.ppc64.devel/12771/focus=12877>
I tried pulling from the git tree, but since I'm using the http protocol
(our firewall unfortunately won't allow the git protocol to go through),
all I get is:
Cannot get remote repository information.
Perhaps git-update-server-info needs to be run there?
-Scott
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 05/18] Add ft_first_node().
2007-01-24 21:59 ` Scott Wood
@ 2007-01-24 23:37 ` David Gibson
0 siblings, 0 replies; 5+ messages in thread
From: David Gibson @ 2007-01-24 23:37 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
On Wed, Jan 24, 2007 at 03:59:18PM -0600, Scott Wood wrote:
> Jerry Van Baren wrote:
> > Have you considered replacing flatdevtree.c with David Gibson's fdtlib?
> > The interface is a lot cleaner, which likely carries through to the
> > underlying code.
In any case I intend to replace the flatdevtree.c code with libfdt at
some point in the future (not too far away, I hope). I'm delaying on
a couple of things at present: first, sorting out IBM-internal
bureaucratic hurdles, second letting the API settle a bit so that I'm
pretty confident it won't want changing.
> > <http://thread.gmane.org/gmane.linux.ports.ppc64.devel/12771/focus=12877>
>
> I tried pulling from the git tree, but since I'm using the http protocol
> (our firewall unfortunately won't allow the git protocol to go through),
> all I get is:
>
> Cannot get remote repository information.
> Perhaps git-update-server-info needs to be run there?
Um.. I'm running git-update-server-info, but the repository wasn't
anywhere http visible. Just moved things around, now try:
git clone http://ozlabs.org/~dgibson/libfdt.git
--
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] 5+ messages in thread
end of thread, other threads:[~2007-01-24 23:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-24 21:07 [PATCH 05/18] Add ft_first_node() Scott Wood
2007-01-24 21:31 ` Jerry Van Baren
2007-01-24 21:59 ` Scott Wood
2007-01-24 23:37 ` David Gibson
2007-01-24 21:46 ` Segher Boessenkool
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).