[U-Boot-Users] [PATCH] fdt: unshadow global working fdt variable

2008-06-10 Thread Kim Phillips
differentiate with local variables of the same name by renaming the
global 'fdt' variable 'working_fdt'.

Signed-off-by: Kim Phillips [EMAIL PROTECTED]
---
applies to current u-boot-fdt.git.

 common/cmd_fdt.c |  114 +++---
 common/fdt_support.c |2 +-
 include/libfdt_env.h |2 +-
 lib_ppc/bootm.c  |2 +-
 4 files changed, 64 insertions(+), 56 deletions(-)

diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index 4285a96..5c3a0bb 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -62,7 +62,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char 
*argv[])
/*
 * Set the address [and length] of the fdt.
 */
-   fdt = (struct fdt_header *)simple_strtoul(argv[2], NULL, 16);
+   working_fdt = (struct fdt_header *)simple_strtoul(argv[2], 
NULL, 16);
 
if (!fdt_valid()) {
return 1;
@@ -75,15 +75,15 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char 
*argv[])
 * Optional new length
 */
len = simple_strtoul(argv[3], NULL, 16);
-   if (len  fdt_totalsize(fdt)) {
+   if (len  fdt_totalsize(working_fdt)) {
printf (New length %d  existing length %d, 
ignoring.\n,
-   len, fdt_totalsize(fdt));
+   len, fdt_totalsize(working_fdt));
} else {
/*
 * Open in place with a new length.
 */
-   err = fdt_open_into(fdt, fdt, len);
+   err = fdt_open_into(working_fdt, working_fdt, 
len);
if (err != 0) {
printf (libfdt fdt_open_into(): %s\n,
fdt_strerror(err));
@@ -92,7 +92,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char 
*argv[])
}
 
/
-* Move the fdt
+* Move the working_fdt
 /
} else if (strncmp(argv[1], mo, 2) == 0) {
struct fdt_header *newaddr;
@@ -107,7 +107,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char 
*argv[])
/*
 * Set the address and length of the fdt.
 */
-   fdt = (struct fdt_header *)simple_strtoul(argv[2], NULL, 16);
+   working_fdt = (struct fdt_header *)simple_strtoul(argv[2], 
NULL, 16);
if (!fdt_valid()) {
return 1;
}
@@ -119,13 +119,13 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char 
*argv[])
 * current length.
 */
if (argc = 4) {
-   len = fdt_totalsize(fdt);
+   len = fdt_totalsize(working_fdt);
} else {
len = simple_strtoul(argv[4], NULL, 16);
-   if (len  fdt_totalsize(fdt)) {
+   if (len  fdt_totalsize(working_fdt)) {
printf (New length 0x%X  existing length 
0x%X, aborting.\n,
-   len, fdt_totalsize(fdt));
+   len, fdt_totalsize(working_fdt));
return 1;
}
}
@@ -133,13 +133,13 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char 
*argv[])
/*
 * Copy to the new location.
 */
-   err = fdt_open_into(fdt, newaddr, len);
+   err = fdt_open_into(working_fdt, newaddr, len);
if (err != 0) {
printf (libfdt fdt_open_into(): %s\n,
fdt_strerror(err));
return 1;
}
-   fdt = newaddr;
+   working_fdt = newaddr;
 
/
 * Make a new node
@@ -161,7 +161,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char 
*argv[])
pathp = argv[2];
nodep = argv[3];
 
-   nodeoffset = fdt_path_offset (fdt, pathp);
+   nodeoffset = fdt_path_offset (working_fdt, pathp);
if (nodeoffset  0) {
/*
 * Not found or something else bad happened.
@@ -170,7 +170,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char 
*argv[])

Re: [U-Boot-Users] [PATCH] fdt: unshadow global working fdt variable

2008-06-10 Thread Kumar Gala

On Jun 10, 2008, at 11:06 AM, Kim Phillips wrote:

 differentiate with local variables of the same name by renaming the
 global 'fdt' variable 'working_fdt'.

 Signed-off-by: Kim Phillips [EMAIL PROTECTED]
 ---
 applies to current u-boot-fdt.git.

thank you, this was just evil.

- k


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users