All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.m@jp.panasonic.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/9] fdt_support: delete force argument of fdt_initrd()
Date: Fri, 14 Feb 2014 22:30:23 +0900	[thread overview]
Message-ID: <1392384629-18771-4-git-send-email-yamada.m@jp.panasonic.com> (raw)
In-Reply-To: <1392384629-18771-1-git-send-email-yamada.m@jp.panasonic.com>

After all, we have realized "force" argument is completely
useless. fdt_initrd() was always called with force = 1.

We should always want to do the same thing
(set appropriate value to the property)
even if the property already exists.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

 arch/microblaze/lib/bootm.c |  2 +-
 common/cmd_fdt.c            |  2 +-
 common/fdt_support.c        | 35 +++++++++++++++--------------------
 common/image-fdt.c          |  2 +-
 include/fdt_support.h       |  2 +-
 5 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c
index d60b307..6977dd6 100644
--- a/arch/microblaze/lib/bootm.c
+++ b/arch/microblaze/lib/bootm.c
@@ -58,7 +58,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
 	/* fixup the initrd now that we know where it should be */
 	if (images->rd_start && images->rd_end && of_flat_tree)
 		ret = fdt_initrd(of_flat_tree, images->rd_start,
-				 images->rd_end, 1);
+				 images->rd_end);
 		if (ret)
 			return 1;
 
diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index 3a9edd6..71ea367 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -582,7 +582,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		}
 
 		fdt_chosen(working_fdt, 1);
-		fdt_initrd(working_fdt, initrd_start, initrd_end, 1);
+		fdt_initrd(working_fdt, initrd_start, initrd_end);
 	}
 	/* resize the fdt */
 	else if (strncmp(argv[1], "re", 2) == 0) {
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 849bdc8..3e16e8a 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -177,12 +177,11 @@ static int fdt_fixup_stdout(void *fdt, int chosenoff)
 }
 #endif
 
-int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)
+int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end)
 {
 	int   nodeoffset, addr_cell_len;
 	int   err, j, total;
 	fdt64_t  tmp;
-	const char *path;
 	uint64_t addr, size;
 
 	/* find or create "/chosen" node. */
@@ -216,26 +215,22 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 
 	addr_cell_len = get_cells_len(fdt, "#address-cells");
 
-	path = fdt_getprop(fdt, nodeoffset, "linux,initrd-start", NULL);
-	if ((path == NULL) || force) {
-		write_cell((u8 *)&tmp, initrd_start, addr_cell_len);
-		err = fdt_setprop(fdt, nodeoffset,
-			"linux,initrd-start", &tmp, addr_cell_len);
-		if (err < 0) {
-			printf("WARNING: "
-				"could not set linux,initrd-start %s.\n",
-				fdt_strerror(err));
-			return err;
-		}
-		write_cell((u8 *)&tmp, initrd_end, addr_cell_len);
-		err = fdt_setprop(fdt, nodeoffset,
+	write_cell((u8 *)&tmp, initrd_start, addr_cell_len);
+	err = fdt_setprop(fdt, nodeoffset,
+			  "linux,initrd-start", &tmp, addr_cell_len);
+	if (err < 0) {
+		printf("WARNING: could not set linux,initrd-start %s.\n",
+		       fdt_strerror(err));
+		return err;
+	}
+	write_cell((u8 *)&tmp, initrd_end, addr_cell_len);
+	err = fdt_setprop(fdt, nodeoffset,
 			"linux,initrd-end", &tmp, addr_cell_len);
-		if (err < 0) {
-			printf("WARNING: could not set linux,initrd-end %s.\n",
-				fdt_strerror(err));
+	if (err < 0) {
+		printf("WARNING: could not set linux,initrd-end %s.\n",
+		       fdt_strerror(err));
 
-			return err;
-		}
+		return err;
 	}
 
 	return 0;
diff --git a/common/image-fdt.c b/common/image-fdt.c
index a54a919..a632c84 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -483,7 +483,7 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
 	/* Create a new LMB reservation */
 	lmb_reserve(lmb, (ulong)blob, of_size);
 
-	fdt_initrd(blob, *initrd_start, *initrd_end, 1);
+	fdt_initrd(blob, *initrd_start, *initrd_end);
 	if (!ft_verify_fdt(blob))
 		return -1;
 
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 9871e2f..786e797 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -15,7 +15,7 @@
 u32 fdt_getprop_u32_default(const void *fdt, const char *path,
 				const char *prop, const u32 dflt);
 int fdt_chosen(void *fdt, int force);
-int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force);
+int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end);
 void do_fixup_by_path(void *fdt, const char *path, const char *prop,
 		      const void *val, int len, int create);
 void do_fixup_by_path_u32(void *fdt, const char *path, const char *prop,
-- 
1.8.3.2

  parent reply	other threads:[~2014-02-14 13:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14 13:30 [U-Boot] [PATCH 0/9] Refactoring and Endian bug fixes of fdt_support Masahiro Yamada
2014-02-14 13:30 ` [U-Boot] [PATCH 1/9] fdt_support: delete unnecessary DECLARE_GLOBAL_DATA_PTR Masahiro Yamada
2014-02-14 13:30 ` [U-Boot] [PATCH 2/9] fdt_support: refactor with fdt_find_or_add_subnode helper func Masahiro Yamada
2014-02-14 13:30 ` Masahiro Yamada [this message]
2014-02-14 13:30 ` [U-Boot] [PATCH 4/9] fdt_support: delete force argument of fdt_chosen() Masahiro Yamada
2014-02-14 13:30 ` [U-Boot] [PATCH 5/9] fdt_support: refactor fdt_fixup_stdout() function Masahiro Yamada
2014-02-14 13:30 ` [U-Boot] [PATCH 6/9] fdt_support: add 'const' qualifier for unchanged argument Masahiro Yamada
2014-02-20  8:55   ` Masahiro Yamada
2014-02-20 13:31     ` Tom Rini
2014-04-15  4:05       ` Masahiro Yamada
2014-02-14 13:30 ` [U-Boot] [PATCH 7/9] fdt_support: fix an endian bug of fdt_fixup_memory_banks Masahiro Yamada
2014-02-14 13:30 ` [U-Boot] [PATCH 8/9] fdt_support: fix an endian bug of fdt_initrd() Masahiro Yamada
2014-02-14 13:30 ` [U-Boot] [PATCH 9/9] fdt_support: correct the return condition " Masahiro Yamada

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=1392384629-18771-4-git-send-email-yamada.m@jp.panasonic.com \
    --to=yamada.m@jp.panasonic.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.