]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fdt: Tidy up the code a bit with fdt addr
authorSimon Glass <sjg@chromium.org>
Wed, 21 Jul 2021 20:55:25 +0000 (14:55 -0600)
committerSimon Glass <sjg@chromium.org>
Sun, 1 Aug 2021 15:05:24 +0000 (09:05 -0600)
Clean up the code a little before changing it.

Signed-off-by: Simon Glass <sjg@chromium.org>
cmd/fdt.c

index f1e2fc2fd8bf93ea5df1bd45ca9fe85ae6e6e001..5acc3ebaf3356e4bbcdcff8717b5fc38448ce4a3 100644 (file)
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -115,26 +115,20 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
        if (argc < 2)
                return CMD_RET_USAGE;
 
-       /*
-        * Set the address of the fdt
-        */
+       /* fdt addr: Set the address of the fdt */
        if (strncmp(argv[1], "ad", 2) == 0) {
                unsigned long addr;
                int control = 0;
                struct fdt_header *blob;
-               /*
-                * Set the address [and length] of the fdt.
-                */
+
+               /* Set the address [and length] of the fdt */
                argc -= 2;
                argv += 2;
-/* Temporary #ifdef - some archs don't have fdt_blob yet */
-#ifdef CONFIG_OF_CONTROL
                if (argc && !strcmp(*argv, "-c")) {
                        control = 1;
                        argc--;
                        argv++;
                }
-#endif
                if (argc == 0) {
                        if (control)
                                blob = (struct fdt_header *)gd->fdt_blob;
@@ -160,22 +154,18 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
                if (argc >= 2) {
                        int  len;
                        int  err;
-                       /*
-                        * Optional new length
-                        */
+
+                       /* Optional new length */
                        len = simple_strtoul(argv[1], NULL, 16);
                        if (len < fdt_totalsize(blob)) {
-                               printf ("New length %d < existing length %d, "
-                                       "ignoring.\n",
-                                       len, fdt_totalsize(blob));
+                               printf("New length %d < existing length %d, ignoring\n",
+                                      len, fdt_totalsize(blob));
                        } else {
-                               /*
-                                * Open in place with a new length.
-                                */
+                               /* Open in place with a new length */
                                err = fdt_open_into(blob, blob, len);
                                if (err != 0) {
-                                       printf ("libfdt fdt_open_into(): %s\n",
-                                               fdt_strerror(err));
+                                       printf("libfdt fdt_open_into(): %s\n",
+                                              fdt_strerror(err));
                                }
                        }
                }
@@ -184,10 +174,9 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
        }
 
        if (!working_fdt) {
-               puts(
-                       "No FDT memory address configured. Please configure\n"
-                       "the FDT address via \"fdt addr <address>\" command.\n"
-                       "Aborting!\n");
+               puts("No FDT memory address configured. Please configure\n"
+                    "the FDT address via \"fdt addr <address>\" command.\n"
+                    "Aborting!\n");
                return CMD_RET_FAILURE;
        }