mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 01/12] oftree: add of_fix_tree()
Date: Thu, 15 Dec 2011 11:30:23 +0100	[thread overview]
Message-ID: <1323945034-19687-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1323945034-19687-1-git-send-email-s.hauer@pengutronix.de>

Currently we have of_get_fixed_tree() which assumes that
there is a global variable holding a oftree. This seems
not very flexible, so for now introduce a of_fix_tree()
which takes an fdt_header as argument and walks the
list of registered of fixup functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/oftree.c |   22 +++++++++++++++-------
 include/of.h    |    1 +
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/common/oftree.c b/common/oftree.c
index 2a2f464..a657d31 100644
--- a/common/oftree.c
+++ b/common/oftree.c
@@ -293,20 +293,28 @@ int of_register_fixup(int (*fixup)(struct fdt_header *))
 	return 0;
 }
 
-struct fdt_header *of_get_fixed_tree(void)
+int of_fix_tree(struct fdt_header *fdt)
 {
 	struct of_fixup *of_fixup;
 	int ret;
 
-	if (!barebox_fdt)
-		return NULL;
-
 	list_for_each_entry(of_fixup, &of_fixup_list, list) {
-		ret = of_fixup->fixup(barebox_fdt);
+		ret = of_fixup->fixup(fdt);
 		if (ret)
-			return NULL;
+			return ret;
 	}
 
-	return barebox_fdt;
+	return 0;
 }
 
+struct fdt_header *of_get_fixed_tree(void)
+{
+	int ret;
+
+	if (!barebox_fdt)
+		return NULL;
+	ret = of_fix_tree(barebox_fdt);
+	if (ret)
+		return NULL;
+	return barebox_fdt;
+}
diff --git a/include/of.h b/include/of.h
index c2661ef..609b3b5 100644
--- a/include/of.h
+++ b/include/of.h
@@ -8,6 +8,7 @@ extern struct fdt_header *barebox_fdt;
 int fdt_print(struct fdt_header *working_fdt, const char *pathp);
 
 struct fdt_header *of_get_fixed_tree(void);
+int of_fix_tree(struct fdt_header *fdt);
 int of_register_fixup(int (*fixup)(struct fdt_header *));
 
 int fdt_find_and_setprop(struct fdt_header *fdt, const char *node, const char *prop,
-- 
1.7.7.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2011-12-15 10:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-15 10:30 reimplement bootm support Sascha Hauer
2011-12-15 10:30 ` Sascha Hauer [this message]
2011-12-18 13:07   ` *** PROBABLY SPAM *** [PATCH 01/12] oftree: add of_fix_tree() Jean-Christophe PLAGNIOL-VILLARD
2011-12-19 10:31     ` Sascha Hauer
2011-12-20 14:03       ` Jean-Christophe PLAGNIOL-VILLARD
2011-12-23 17:14         ` Sascha Hauer
2011-12-25  6:09           ` Jean-Christophe PLAGNIOL-VILLARD
2012-01-02 11:49             ` Sascha Hauer
2011-12-15 10:30 ` [PATCH 02/12] filetype: Add oftree detection Sascha Hauer
2011-12-15 10:30 ` [PATCH 03/12] uncompress: implement uncompress_fd_to_buf Sascha Hauer
2011-12-15 10:30 ` [PATCH 04/12] libbb: add read_full/write_full functions Sascha Hauer
2011-12-15 10:30 ` [PATCH 05/12] ARM: call start_linux directly with initrd start/size and oftree Sascha Hauer
2011-12-15 10:30 ` [PATCH 06/12] reimplement uImage code Sascha Hauer
2011-12-15 13:33   ` *** PROBABLY SPAM *** " Jean-Christophe PLAGNIOL-VILLARD
2011-12-15 15:27     ` Sascha Hauer
2011-12-15 16:20       ` Jean-Christophe PLAGNIOL-VILLARD
2011-12-15 16:39         ` Sascha Hauer
2011-12-15 10:30 ` [PATCH 07/12] bootm: use new uimage code Sascha Hauer
2011-12-15 10:30 ` [PATCH 08/12] add uimage command Sascha Hauer
2011-12-15 10:30 ` [PATCH 09/12] remove now obsolete iminfo command Sascha Hauer
2011-12-15 10:30 ` [PATCH 10/12] remove now unused uImage code Sascha Hauer
2011-12-15 10:30 ` [PATCH 11/12] move code now only used in mkimage to mkimage Sascha Hauer
2011-12-15 10:30 ` [PATCH 12/12] defaultenv: simplify boot Sascha Hauer
2011-12-15 13:37 ` *** PROBABLY SPAM *** reimplement bootm support Jean-Christophe PLAGNIOL-VILLARD
2011-12-15 14:47   ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1323945034-19687-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox