[U-Boot] [PATCH v2 4/9] fdt_support: delete force argument of fdt_chosen()
Masahiro Yamada
yamada.m at jp.panasonic.com
Fri Apr 18 10:41:00 CEST 2014
After all, we have realized "force" argument is completely
useless. fdt_chosen() 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 at jp.panasonic.com>
---
Changes in v2: None
common/cmd_fdt.c | 2 +-
common/fdt_support.c | 38 ++++++++++++--------------------------
common/image-fdt.c | 2 +-
include/fdt_support.h | 2 +-
4 files changed, 15 insertions(+), 29 deletions(-)
diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index cc2b0e2..6831af4 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -581,7 +581,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
initrd_end = simple_strtoul(argv[3], NULL, 16);
}
- fdt_chosen(working_fdt, 1);
+ fdt_chosen(working_fdt);
fdt_initrd(working_fdt, initrd_start, initrd_end);
#if defined(CONFIG_FIT_SIGNATURE)
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 3e16e8a..c714ffa 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -236,12 +236,11 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end)
return 0;
}
-int fdt_chosen(void *fdt, int force)
+int fdt_chosen(void *fdt)
{
int nodeoffset;
int err;
char *str; /* used to set string properties */
- const char *path;
err = fdt_check_header(fdt);
if (err < 0) {
@@ -254,38 +253,25 @@ int fdt_chosen(void *fdt, int force)
if (nodeoffset < 0)
return nodeoffset;
- /*
- * Create /chosen properites that don't exist in the fdt.
- * If the property exists, update it only if the "force" parameter
- * is true.
- */
str = getenv("bootargs");
if (str != NULL) {
- path = fdt_getprop(fdt, nodeoffset, "bootargs", NULL);
- if ((path == NULL) || force) {
- err = fdt_setprop(fdt, nodeoffset,
- "bootargs", str, strlen(str)+1);
- if (err < 0)
- printf("WARNING: could not set bootargs %s.\n",
- fdt_strerror(err));
- }
+ err = fdt_setprop(fdt, nodeoffset,
+ "bootargs", str, strlen(str)+1);
+ if (err < 0)
+ printf("WARNING: could not set bootargs %s.\n",
+ fdt_strerror(err));
}
#ifdef CONFIG_OF_STDOUT_VIA_ALIAS
- path = fdt_getprop(fdt, nodeoffset, "linux,stdout-path", NULL);
- if ((path == NULL) || force)
- err = fdt_fixup_stdout(fdt, nodeoffset);
+ err = fdt_fixup_stdout(fdt, nodeoffset);
#endif
#ifdef OF_STDOUT_PATH
- path = fdt_getprop(fdt, nodeoffset, "linux,stdout-path", NULL);
- if ((path == NULL) || force) {
- err = fdt_setprop(fdt, nodeoffset,
- "linux,stdout-path", OF_STDOUT_PATH, strlen(OF_STDOUT_PATH)+1);
- if (err < 0)
- printf("WARNING: could not set linux,stdout-path %s.\n",
- fdt_strerror(err));
- }
+ err = fdt_setprop(fdt, nodeoffset, "linux,stdout-path",
+ OF_STDOUT_PATH, strlen(OF_STDOUT_PATH)+1);
+ if (err < 0)
+ printf("WARNING: could not set linux,stdout-path %s.\n",
+ fdt_strerror(err));
#endif
return err;
diff --git a/common/image-fdt.c b/common/image-fdt.c
index a632c84..781ab8e 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -457,7 +457,7 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
ulong *initrd_end = &images->initrd_end;
int ret;
- if (fdt_chosen(blob, 1) < 0) {
+ if (fdt_chosen(blob) < 0) {
puts("ERROR: /chosen node create failed");
puts(" - must RESET the board to recover.\n");
return -1;
diff --git a/include/fdt_support.h b/include/fdt_support.h
index c10e930..7237e9a 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -14,7 +14,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_chosen(void *fdt);
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);
--
1.8.3.2
More information about the U-Boot
mailing list