Skip to contentSkip to conversation

spl: Add some missing newlines

PATCH In review Andrew F. Davis 5 participants 7 messages Jan 12, 2017 – Jan 23, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spl: Add some missing newlines

---
 common/spl/spl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/spl/spl.c +2 -2
index a76ea3a603..e43718de62 100644
@@ -316,7 +316,7 @@ static int boot_from_devices(struct spl_image_info *spl_image,
 		loader = spl_ll_find_loader(spl_boot_list[i]);
 #if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
 		if (loader)
-			printf("Trying to boot from %s", loader->name);
+			printf("Trying to boot from %s\n", loader->name);
 		else
 			puts("SPL: Unsupported Boot Device!\n");
 #endif
@@ -389,7 +389,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	      gd->malloc_ptr / 1024);
 #endif
 
-	debug("loaded - jumping to U-Boot...");
+	debug("loaded - jumping to U-Boot...\n");
 	spl_board_prepare_for_boot();
 	jump_to_image_no_args(&spl_image);
 }
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 spl: Add some missing newlines

Quoted 19 lines · Andrew F. Davis
---
 common/spl/spl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/spl/spl.c +1 -1
index a76ea3a603..e43718de62 100644
@@ -316,7 +316,7 @@ static int boot_from_devices(struct spl_image_info *spl_image,
 		loader = spl_ll_find_loader(spl_boot_list[i]);
 #if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
 		if (loader)
-			printf("Trying to boot from %s", loader->name);
+			printf("Trying to boot from %s\n", loader->name);
 		else
 			puts("SPL: Unsupported Boot Device!\n");
 #endif

common/spl/spl.c void board_init_r(gd_t *dummy1, ulong dummy2) · line 392

Quoted 5 lines
common/spl/spl.c +1 -1
@@ -389,7 +389,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	      gd->malloc_ptr / 1024);
 #endif
 
-	debug("loaded - jumping to U-Boot...");
+	debug("loaded - jumping to U-Boot...\n");

Thanks and regards,
Lokesh

#2 lore raw

PATCH 1/1 spl: Add some missing newlines

In reply to Andrew F. Davis

2017-01-12 17:19 GMT+01:00 Andrew F. Davis <[email protected]>:

Quoted 30 lines
---
 common/spl/spl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/spl/spl.c +1 -1
index a76ea3a603..e43718de62 100644
@@ -316,7 +316,7 @@ static int boot_from_devices(struct spl_image_info
 *spl_image,
                loader = spl_ll_find_loader(spl_boot_list[i]);
 #if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_
 SUPPORT)
                if (loader)
-                       printf("Trying to boot from %s", loader->name);
+                       printf("Trying to boot from %s\n", loader->name);
                else
                        puts("SPL: Unsupported Boot Device!\n");

#endif

common/spl/spl.c +1 -2
@@ -389,7 +389,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
              gd->malloc_ptr / 1024);
 #endif
 
-       debug("loaded - jumping to U-Boot...");
+       debug("loaded - jumping to U-Boot...\n");
        spl_board_prepare_for_boot();
        jump_to_image_no_args(&spl_image);
 }
--
Quoted 2 lines

2.11.0

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
#3 lore raw
In reply to Andrew F. Davis
Quoted 3 lines · Andrew F. Davis

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170120/8872531b/attachment.sig>
#4 lore raw

PATCH 1/1 spl: Add some missing newlines

In reply to Andrew F. Davis

Hi Andrew,

Quoted 19 lines · Andrew F. Davis
---
 common/spl/spl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/spl/spl.c +1 -1
index a76ea3a603..e43718de62 100644
@@ -316,7 +316,7 @@ static int boot_from_devices(struct spl_image_info *spl_image,
                loader = spl_ll_find_loader(spl_boot_list[i]);
 #if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
                if (loader)
-                       printf("Trying to boot from %s", loader->name);
+                       printf("Trying to boot from %s\n", loader->name);
                else
                        puts("SPL: Unsupported Boot Device!\n");
 #endif

common/spl/spl.c void board_init_r(gd_t *dummy1, ulong dummy2) · line 392

Quoted 5 lines
common/spl/spl.c +1 -1
@@ -389,7 +389,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
              gd->malloc_ptr / 1024);
 #endif
 
-       debug("loaded - jumping to U-Boot...");
+       debug("loaded - jumping to U-Boot...\n");

I prefer this one as it is, since U-Boot prints a few newlines anyway, and this way we can have the cursor at the end of the 'jumping' line until U-Boot starts.

What's the rationale for changing it. Could you add a commit message?

Quoted 6 lines
common/spl/spl.c +0 -1
        spl_board_prepare_for_boot();
        jump_to_image_no_args(&spl_image);
 }
--

2.11.0

Regards,
Simon

#5 lore raw

PATCH 1/1 spl: Add some missing newlines

Quoted 25 lines · Simon Glass

Hi Andrew,

Quoted 22 lines · Andrew F. Davis
---
 common/spl/spl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/spl/spl.c +1 -1
index a76ea3a603..e43718de62 100644
@@ -316,7 +316,7 @@ static int boot_from_devices(struct spl_image_info *spl_image,
                loader = spl_ll_find_loader(spl_boot_list[i]);
 #if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
                if (loader)
-                       printf("Trying to boot from %s", loader->name);
+                       printf("Trying to boot from %s\n", loader->name);
                else
                        puts("SPL: Unsupported Boot Device!\n");
 #endif
@@ -389,7 +389,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
              gd->malloc_ptr / 1024);
 #endif
 
Quoted 9 lines

common/spl/spl.c void board_init_r(gd_t *dummy1, ulong dummy2) · line 392

Quoted 2 lines
common/spl/spl.c +1 -1
-       debug("loaded - jumping to U-Boot...");
+       debug("loaded - jumping to U-Boot...\n");

I prefer this one as it is, since U-Boot prints a few newlines anyway, and this way we can have the cursor at the end of the 'jumping' line until U-Boot starts.

What's the rationale for changing it. Could you add a commit message?

Looks like this already has be taken, but I'll explain myself anyway.

The way I see it, for consistency sake, the only reason a print statement should not end in a newline is iff they expect something to be printed on the same line after. This is not the case here, we *do* want a newline after this statement, we are just expecting it to be handled later (hopefully). Not sticking to this standard will lead to a lot of print statements starting with '\n' to be safe. For instance even if we knew what follows should emit some newlines, this is a debug statement, it may not printed, so the following line would still have to begin with a newline "just in-case", we would end up with half our print out lines with two new lines above them.

Andrew

#6 lore raw

PATCH 1/1 spl: Add some missing newlines

Hi Andrew,

Quoted 38 lines · Andrew F. Davis
Quoted 25 lines · Simon Glass

Hi Andrew,

Quoted 22 lines · Andrew F. Davis
---
 common/spl/spl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/spl/spl.c +1 -1
index a76ea3a603..e43718de62 100644
@@ -316,7 +316,7 @@ static int boot_from_devices(struct spl_image_info *spl_image,
                loader = spl_ll_find_loader(spl_boot_list[i]);
 #if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
                if (loader)
-                       printf("Trying to boot from %s", loader->name);
+                       printf("Trying to boot from %s\n", loader->name);
                else
                        puts("SPL: Unsupported Boot Device!\n");
 #endif
@@ -389,7 +389,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
              gd->malloc_ptr / 1024);
 #endif
 
Quoted 9 lines

common/spl/spl.c void board_init_r(gd_t *dummy1, ulong dummy2) · line 392

Quoted 2 lines
common/spl/spl.c +1 -1
-       debug("loaded - jumping to U-Boot...");
+       debug("loaded - jumping to U-Boot...\n");

I prefer this one as it is, since U-Boot prints a few newlines anyway, and this way we can have the cursor at the end of the 'jumping' line until U-Boot starts.

What's the rationale for changing it. Could you add a commit message?

Looks like this already has be taken, but I'll explain myself anyway.

Quoted 10 lines

The way I see it, for consistency sake, the only reason a print statement should not end in a newline is iff they expect something to be printed on the same line after. This is not the case here, we *do* want a newline after this statement, we are just expecting it to be handled later (hopefully). Not sticking to this standard will lead to a lot of print statements starting with '\n' to be safe. For instance even if we knew what follows should emit some newlines, this is a debug statement, it may not printed, so the following line would still have to begin with a newline "just in-case", we would end up with half our print out lines with two new lines above them.

Of course you are right in general and I agree with your rule. But in this case we know we are jumping to U-Boot, and that U-Boot prints a few newlines at the start. I suppose you could argue that you might turn on some debug UART output early in U-Boot which would mess that up. If you made that argument then I might agree with you :-) But for most users this avoids an unnecessary newline.

Regards,
Simon