mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/4] Change printf behaviour
@ 2021-05-21 16:34 Marco Felsch
  2021-05-21 16:34 ` [PATCH 1/4] commands: mount: replace printf by pr_info Marco Felsch
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Marco Felsch @ 2021-05-21 16:34 UTC (permalink / raw)
  To: barebox

Hi all,

my current project needs barebox as quite as possible since it has
strict boot time requirements. Unfortunately barebox was still a bit to
talkative after setting the default loglevel to 4 (warn). Therefore I
made these changes which saved ~40ms during a normal blspec boot.

Regards,
  Marco

Marco Felsch (4):
  commands: mount: replace printf by pr_info
  common: boot: replace printf by pr_info/warn variants
  common: bootm: replace printf by pr_err/info
  common: oftree: replace printf by pr_info

 commands/mount.c |  2 +-
 common/boot.c    |  4 +--
 common/bootm.c   | 88 ++++++++++++++++++++++++------------------------
 common/oftree.c  |  2 +-
 4 files changed, 48 insertions(+), 48 deletions(-)

-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] commands: mount: replace printf by pr_info
  2021-05-21 16:34 [PATCH 0/4] Change printf behaviour Marco Felsch
@ 2021-05-21 16:34 ` Marco Felsch
  2021-05-25  5:15   ` Sascha Hauer
  2021-05-21 16:34 ` [PATCH 2/4] common: boot: replace printf by pr_info/warn variants Marco Felsch
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Marco Felsch @ 2021-05-21 16:34 UTC (permalink / raw)
  To: barebox

This allows us to control the output behaviour e.g. booting silently
to improve boot time.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 commands/mount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/mount.c b/commands/mount.c
index ff1d8bc5e5..bb2d1d60f4 100644
--- a/commands/mount.c
+++ b/commands/mount.c
@@ -74,7 +74,7 @@ static int do_mount(int argc, char *argv[])
 		if (IS_ERR(path))
 			return PTR_ERR(path);
 
-		printf("mounted /dev/%s on %s\n", devstr, path);
+		pr_info("mounted /dev/%s on %s\n", devstr, path);
 
 		return 0;
 	}
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/4] common: boot: replace printf by pr_info/warn variants
  2021-05-21 16:34 [PATCH 0/4] Change printf behaviour Marco Felsch
  2021-05-21 16:34 ` [PATCH 1/4] commands: mount: replace printf by pr_info Marco Felsch
@ 2021-05-21 16:34 ` Marco Felsch
  2021-05-21 16:34 ` [PATCH 3/4] common: bootm: replace printf by pr_err/info Marco Felsch
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Marco Felsch @ 2021-05-21 16:34 UTC (permalink / raw)
  To: barebox

This allows us to control the output behaviour e.g. booting silently
to improve boot time. Furthermore it adds a 'WARNING:' prefixed output
in case of pr_warn which is colored as well (depending on your
terminal). This helps us to identify unwanted behaviour.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 common/boot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/boot.c b/common/boot.c
index 07b67734d8..8220b8d3fb 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -138,7 +138,7 @@ int boot_entry(struct bootentry *be, int verbose, int dryrun)
 {
 	int ret;
 
-	printf("Booting entry '%s'\n", be->title);
+	pr_info("Booting entry '%s'\n", be->title);
 
 	if (IS_ENABLED(CONFIG_WATCHDOG) && boot_watchdog_timeout) {
 		boot_enabled_watchdog = watchdog_get_default();
@@ -319,7 +319,7 @@ void bootsources_menu(struct bootentries *bootentries, int timeout)
 	struct menu_entry *back_entry;
 
 	if (!IS_ENABLED(CONFIG_MENU)) {
-		printf("no menu support available\n");
+		pr_warn("no menu support available\n");
 		return;
 	}
 
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/4] common: bootm: replace printf by pr_err/info
  2021-05-21 16:34 [PATCH 0/4] Change printf behaviour Marco Felsch
  2021-05-21 16:34 ` [PATCH 1/4] commands: mount: replace printf by pr_info Marco Felsch
  2021-05-21 16:34 ` [PATCH 2/4] common: boot: replace printf by pr_info/warn variants Marco Felsch
@ 2021-05-21 16:34 ` Marco Felsch
  2021-05-21 16:34 ` [PATCH 4/4] common: oftree: replace printf by pr_info Marco Felsch
  2021-05-21 16:52 ` [PATCH 0/4] Change printf behaviour Marco Felsch
  4 siblings, 0 replies; 9+ messages in thread
From: Marco Felsch @ 2021-05-21 16:34 UTC (permalink / raw)
  To: barebox

This allows us to control the output behaviour e.g. booting silently
to improve boot time. Furthermore it adds a 'ERROR:' prefixed output
in case of pr_err which is colored as well (depending on your
terminal). This helps us to identify unwanted behaviour.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 common/bootm.c | 88 +++++++++++++++++++++++++-------------------------
 1 file changed, 44 insertions(+), 44 deletions(-)

diff --git a/common/bootm.c b/common/bootm.c
index 092116beb9..8948ddbca2 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -111,7 +111,7 @@ int bootm_load_os(struct image_data *data, unsigned long load_address)
 		data->os_res = request_sdram_region("kernel",
 				load_address, kernel_size);
 		if (!data->os_res) {
-			printf("unable to request SDRAM region for kernel at"
+			pr_err("unable to request SDRAM region for kernel at"
 					"0x%08llx-0x%08llx\n",
 				(unsigned long long)load_address,
 				(unsigned long long)load_address + kernel_size - 1);
@@ -175,7 +175,7 @@ static int bootm_open_initrd_uimage(struct image_data *data)
 		if (bootm_get_verify_mode() > BOOTM_VERIFY_NONE) {
 			ret = uimage_verify(data->initrd);
 			if (ret) {
-				printf("Checking data crc failed with %s\n",
+				pr_err("Checking data crc failed with %s\n",
 					strerror(-ret));
 				return ret;
 			}
@@ -231,21 +231,21 @@ int bootm_load_initrd(struct image_data *data, unsigned long load_address)
 				load_address,
 				initrd_size);
 		if (!data->initrd_res) {
-			printf("unable to request SDRAM region for initrd at"
+			pr_err("unable to request SDRAM region for initrd at"
 					"0x%08llx-0x%08llx\n",
 				(unsigned long long)load_address,
 				(unsigned long long)load_address + initrd_size - 1);
 			return -ENOMEM;
 		}
 		memcpy((void *)load_address, initrd, initrd_size);
-		printf("Loaded initrd from FIT image\n");
+		pr_info("Loaded initrd from FIT image\n");
 		goto done1;
 	}
 
 	type = file_name_detect_type(data->initrd_file);
 
 	if ((int)type < 0) {
-		printf("could not open %s: %s\n", data->initrd_file,
+		pr_err("could not open %s: %s\n", data->initrd_file,
 				strerror(-type));
 		return (int)type;
 	}
@@ -254,8 +254,8 @@ int bootm_load_initrd(struct image_data *data, unsigned long load_address)
 		int num;
 		ret = bootm_open_initrd_uimage(data);
 		if (ret) {
-			printf("loading initrd failed with %s\n",
-					strerror(-ret));
+			pr_err("loading initrd failed with %s\n",
+			       strerror(-ret));
 			return ret;
 		}
 
@@ -275,13 +275,13 @@ int bootm_load_initrd(struct image_data *data, unsigned long load_address)
 
 done:
 
-	printf("Loaded initrd %s '%s'", file_type_to_string(type),
+	pr_info("Loaded initrd %s '%s'", file_type_to_string(type),
 	       data->initrd_file);
 	if (type == filetype_uimage && data->initrd->header.ih_type == IH_TYPE_MULTI)
-		printf(", multifile image %s", data->initrd_part);
-	printf("\n");
+		pr_info(", multifile image %s", data->initrd_part);
+	pr_info("\n");
 done1:
-	printf("initrd is at %pa-%pa\n",
+	pr_info("initrd is at %pa-%pa\n",
 		&data->initrd_res->start,
 		&data->initrd_res->end);
 
@@ -297,7 +297,7 @@ static int bootm_open_oftree_uimage(struct image_data *data, size_t *size,
 	struct uimage_handle *of_handle;
 	int release = 0;
 
-	printf("Loading devicetree from '%s'@%d\n", oftree, num);
+	pr_info("Loading devicetree from '%s'@%d\n", oftree, num);
 
 	if (!IS_ENABLED(CONFIG_BOOTM_OFTREE_UIMAGE))
 		return -EINVAL;
@@ -321,7 +321,7 @@ static int bootm_open_oftree_uimage(struct image_data *data, size_t *size,
 
 	ft = file_detect_type(*fdt, *size);
 	if (ft != filetype_oftree) {
-		printf("%s is not an oftree but %s\n",
+		pr_err("%s is not an oftree but %s\n",
 			data->oftree_file, file_type_to_string(ft));
 		free(*fdt);
 		return -EINVAL;
@@ -367,8 +367,8 @@ void *bootm_get_devicetree(struct image_data *data)
 		type = file_name_detect_type(data->oftree_file);
 
 		if ((int)type < 0) {
-			printf("could not open %s: %s\n", data->oftree_file,
-					strerror(-type));
+			pr_err("could not open %s: %s\n", data->oftree_file,
+			       strerror(-type));
 			return ERR_PTR((int)type);
 		}
 
@@ -377,7 +377,7 @@ void *bootm_get_devicetree(struct image_data *data)
 			ret = bootm_open_oftree_uimage(data, &size, &oftree);
 			break;
 		case filetype_oftree:
-			printf("Loading devicetree from '%s'\n", data->oftree_file);
+			pr_info("Loading devicetree from '%s'\n", data->oftree_file);
 			ret = read_file_2(data->oftree_file, &size, (void *)&oftree,
 					  FILESIZE_MAX);
 			break;
@@ -448,7 +448,7 @@ int bootm_load_devicetree(struct image_data *data, void *fdt,
 	data->oftree_res = request_sdram_region("oftree", load_address,
 			fdt_size);
 	if (!data->oftree_res) {
-		printf("unable to request SDRAM region for device tree at"
+		pr_err("unable to request SDRAM region for device tree at"
 				"0x%08llx-0x%08llx\n",
 			(unsigned long long)load_address,
 			(unsigned long long)load_address + fdt_size - 1);
@@ -497,7 +497,7 @@ static int bootm_open_os_uimage(struct image_data *data)
 	if (bootm_get_verify_mode() > BOOTM_VERIFY_NONE) {
 		ret = uimage_verify(data->os);
 		if (ret) {
-			printf("Checking data crc failed with %s\n",
+			pr_err("Checking data crc failed with %s\n",
 					strerror(-ret));
 			return ret;
 		}
@@ -506,7 +506,7 @@ static int bootm_open_os_uimage(struct image_data *data)
 	uimage_print_contents(data->os);
 
 	if (IH_ARCH == IH_ARCH_INVALID || data->os->header.ih_arch != IH_ARCH) {
-		printf("Unsupported Architecture 0x%x\n",
+		pr_err("Unsupported Architecture 0x%x\n",
 		       data->os->header.ih_arch);
 		return -EINVAL;
 	}
@@ -526,7 +526,7 @@ static int bootm_open_elf(struct image_data *data)
 	if (IS_ERR(data->elf))
 		return PTR_ERR(data->elf);
 
-	printf("Entry Point:  %08llx\n", data->elf->entry);
+	pr_info("Entry Point:  %08llx\n", data->elf->entry);
 
 	data->os_address = data->elf->entry;
 
@@ -578,7 +578,7 @@ int bootm_boot(struct bootm_data *bootm_data)
 	size_t size;
 
 	if (!bootm_data->os_file) {
-		printf("no image given\n");
+		pr_err("no image given\n");
 		return -ENOENT;
 	}
 
@@ -599,7 +599,7 @@ int bootm_boot(struct bootm_data *bootm_data)
 
 	ret = read_file_2(data->os_file, &size, &data->os_header, PAGE_SIZE);
 	if (ret < 0 && ret != -EFBIG) {
-		printf("could not open %s: %s\n", data->os_file,
+		pr_err("could not open %s: %s\n", data->os_file,
 				strerror(-ret));
 		goto err_out;
 	}
@@ -609,7 +609,7 @@ int bootm_boot(struct bootm_data *bootm_data)
 	os_type = file_detect_type(data->os_header, PAGE_SIZE);
 
 	if (!data->force && os_type == filetype_unknown) {
-		printf("Unknown OS filetype (try -f)\n");
+		pr_err("Unknown OS filetype (try -f)\n");
 		ret = -EINVAL;
 		goto err_out;
 	}
@@ -625,7 +625,7 @@ int bootm_boot(struct bootm_data *bootm_data)
 		data->initrd_file = NULL;
 		data->tee_file = NULL;
 		if (os_type != filetype_oftree) {
-			printf("Signed boot and image is no FIT image, aborting\n");
+			pr_err("Signed boot and image is no FIT image, aborting\n");
 			ret = -EINVAL;
 			goto err_out;
 		}
@@ -637,7 +637,7 @@ int bootm_boot(struct bootm_data *bootm_data)
 
 		fit = fit_open(data->os_file, data->verbose, data->verify);
 		if (IS_ERR(fit)) {
-			printf("Loading FIT image %s failed with: %pe\n", data->os_file, fit);
+			pr_err("Loading FIT image %s failed with: %pe\n", data->os_file, fit);
 			ret = PTR_ERR(fit);
 			goto err_out;
 		}
@@ -647,7 +647,7 @@ int bootm_boot(struct bootm_data *bootm_data)
 		data->fit_config = fit_open_configuration(data->os_fit,
 							  data->os_part);
 		if (IS_ERR(data->fit_config)) {
-			printf("Cannot open FIT image configuration '%s'\n",
+			pr_err("Cannot open FIT image configuration '%s'\n",
 			       data->os_part ? data->os_part : "default");
 			ret = PTR_ERR(data->fit_config);
 			goto err_out;
@@ -663,8 +663,8 @@ int bootm_boot(struct bootm_data *bootm_data)
 						    kernel_img,
 						    "load", &data->os_address);
 			if (!ret)
-				printf("Load address from FIT '%s': 0x%lx\n",
-				       kernel_img, data->os_address);
+				pr_info("Load address from FIT '%s': 0x%lx\n",
+					kernel_img, data->os_address);
 			/* Note: Error case uses default value. */
 		}
 		if (data->os_entry == UIMAGE_SOME_ADDRESS) {
@@ -675,8 +675,8 @@ int bootm_boot(struct bootm_data *bootm_data)
 						    "entry", &entry);
 			if (!ret) {
 				data->os_entry = entry - data->os_address;
-				printf("Entry address from FIT '%s': 0x%lx\n",
-				       kernel_img, entry);
+				pr_info("Entry address from FIT '%s': 0x%lx\n",
+					kernel_img, entry);
 			}
 			/* Note: Error case uses default value. */
 		}
@@ -685,8 +685,8 @@ int bootm_boot(struct bootm_data *bootm_data)
 	if (os_type == filetype_uimage) {
 		ret = bootm_open_os_uimage(data);
 		if (ret) {
-			printf("Loading OS image failed with: %s\n",
-					strerror(-ret));
+			pr_err("Loading OS image failed with: %s\n",
+			       strerror(-ret));
 			goto err_out;
 		}
 	}
@@ -694,8 +694,8 @@ int bootm_boot(struct bootm_data *bootm_data)
 	if (os_type == filetype_elf) {
 		ret = bootm_open_elf(data);
 		if (ret) {
-			printf("Loading ELF image failed with: %s\n",
-					strerror(-ret));
+			pr_err("Loading ELF image failed with: %s\n",
+			       strerror(-ret));
 			data->elf = NULL;
 			goto err_out;
 		}
@@ -724,7 +724,7 @@ int bootm_boot(struct bootm_data *bootm_data)
 			rootarg = path_get_linux_rootarg(data->os_file);
 		}
 		if (!IS_ERR(rootarg)) {
-			printf("Adding \"%s\" to Kernel commandline\n", rootarg);
+			pr_info("Adding \"%s\" to Kernel commandline\n", rootarg);
 			globalvar_add_simple("linux.bootargs.bootm.appendroot",
 					     rootarg);
 			free(rootarg);
@@ -736,7 +736,7 @@ int bootm_boot(struct bootm_data *bootm_data)
 		char *machine_id_bootarg;
 
 		if (!machine_id) {
-			printf("Providing machine id is enabled but no machine id set\n");
+			pr_err("Providing machine id is enabled but no machine id set\n");
 			ret = -EINVAL;
 			goto err_out;
 		}
@@ -746,12 +746,12 @@ int bootm_boot(struct bootm_data *bootm_data)
 		free(machine_id_bootarg);
 	}
 
-	printf("\nLoading %s '%s'", file_type_to_string(os_type),
-			data->os_file);
+	pr_info("\nLoading %s '%s'", file_type_to_string(os_type),
+		data->os_file);
 	if (os_type == filetype_uimage &&
 			data->os->header.ih_type == IH_TYPE_MULTI)
-		printf(", multifile image %d", uimage_part_num(data->os_part));
-	printf("\n");
+		pr_info(", multifile image %d", uimage_part_num(data->os_part));
+	pr_info("\n");
 
 	if (data->os_address == UIMAGE_SOME_ADDRESS)
 		data->os_address = UIMAGE_INVALID_ADDRESS;
@@ -760,10 +760,10 @@ int bootm_boot(struct bootm_data *bootm_data)
 
 	handler = bootm_find_handler(os_type, data);
 	if (!handler) {
-		printf("no image handler found for image type %s\n",
-			file_type_to_string(os_type));
+		pr_err("no image handler found for image type %s\n",
+		       file_type_to_string(os_type));
 		if (os_type == filetype_uimage)
-			printf("and OS type: %d\n", data->os->header.ih_os);
+			pr_err("and OS type: %d\n", data->os->header.ih_os);
 		ret = -ENODEV;
 		goto err_out;
 	}
@@ -775,7 +775,7 @@ int bootm_boot(struct bootm_data *bootm_data)
 
 	ret = handler->bootm(data);
 	if (data->dryrun)
-		printf("Dryrun. Aborted\n");
+		pr_info("Dryrun. Aborted\n");
 
 err_out:
 	if (data->os_res)
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 4/4] common: oftree: replace printf by pr_info
  2021-05-21 16:34 [PATCH 0/4] Change printf behaviour Marco Felsch
                   ` (2 preceding siblings ...)
  2021-05-21 16:34 ` [PATCH 3/4] common: bootm: replace printf by pr_err/info Marco Felsch
@ 2021-05-21 16:34 ` Marco Felsch
  2021-05-21 16:52 ` [PATCH 0/4] Change printf behaviour Marco Felsch
  4 siblings, 0 replies; 9+ messages in thread
From: Marco Felsch @ 2021-05-21 16:34 UTC (permalink / raw)
  To: barebox

This allows us to control the output behaviour e.g. booting silently
to improve boot time.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 common/oftree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/oftree.c b/common/oftree.c
index 60d4327155..d92a3ca904 100644
--- a/common/oftree.c
+++ b/common/oftree.c
@@ -115,7 +115,7 @@ void of_print_cmdline(struct device_node *root)
 
 	cmdline = of_get_property(node, "bootargs", NULL);
 
-	printf("commandline: %s\n", cmdline);
+	pr_info("commandline: %s\n", cmdline);
 }
 
 static int of_fixup_bootargs_bootsource(struct device_node *root,
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/4] Change printf behaviour
  2021-05-21 16:34 [PATCH 0/4] Change printf behaviour Marco Felsch
                   ` (3 preceding siblings ...)
  2021-05-21 16:34 ` [PATCH 4/4] common: oftree: replace printf by pr_info Marco Felsch
@ 2021-05-21 16:52 ` Marco Felsch
  4 siblings, 0 replies; 9+ messages in thread
From: Marco Felsch @ 2021-05-21 16:52 UTC (permalink / raw)
  To: barebox

On 21-05-21 18:34, Marco Felsch wrote:
> Hi all,
> 
> my current project needs barebox as quite as possible since it has
					^
				  ... quiet
> strict boot time requirements. Unfortunately barebox was still a bit to
> talkative after setting the default loglevel to 4 (warn). Therefore I
> made these changes which saved ~40ms during a normal blspec boot.
> 
> Regards,
>   Marco
> 
> Marco Felsch (4):
>   commands: mount: replace printf by pr_info
>   common: boot: replace printf by pr_info/warn variants
>   common: bootm: replace printf by pr_err/info
>   common: oftree: replace printf by pr_info
> 
>  commands/mount.c |  2 +-
>  common/boot.c    |  4 +--
>  common/bootm.c   | 88 ++++++++++++++++++++++++------------------------
>  common/oftree.c  |  2 +-
>  4 files changed, 48 insertions(+), 48 deletions(-)
> 
> -- 
> 2.29.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] commands: mount: replace printf by pr_info
  2021-05-21 16:34 ` [PATCH 1/4] commands: mount: replace printf by pr_info Marco Felsch
@ 2021-05-25  5:15   ` Sascha Hauer
  2021-05-25  8:42     ` Marco Felsch
  0 siblings, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2021-05-25  5:15 UTC (permalink / raw)
  To: Marco Felsch; +Cc: barebox

On Fri, May 21, 2021 at 06:34:32PM +0200, Marco Felsch wrote:
> This allows us to control the output behaviour e.g. booting silently
> to improve boot time.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  commands/mount.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/commands/mount.c b/commands/mount.c
> index ff1d8bc5e5..bb2d1d60f4 100644
> --- a/commands/mount.c
> +++ b/commands/mount.c
> @@ -74,7 +74,7 @@ static int do_mount(int argc, char *argv[])
>  		if (IS_ERR(path))
>  			return PTR_ERR(path);
>  
> -		printf("mounted /dev/%s on %s\n", devstr, path);
> +		pr_info("mounted /dev/%s on %s\n", devstr, path);

Applied all except this one. This is the output from the mount command
and as such it should be printed with printf.

I have no good idea to quiesce such output as we don't have any output
redirection. Maybe we need an additional control knob for printf output.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] commands: mount: replace printf by pr_info
  2021-05-25  5:15   ` Sascha Hauer
@ 2021-05-25  8:42     ` Marco Felsch
  2021-05-25 12:28       ` Ahmad Fatoum
  0 siblings, 1 reply; 9+ messages in thread
From: Marco Felsch @ 2021-05-25  8:42 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 21-05-25 07:15, Sascha Hauer wrote:
> On Fri, May 21, 2021 at 06:34:32PM +0200, Marco Felsch wrote:
> > This allows us to control the output behaviour e.g. booting silently
> > to improve boot time.
> > 
> > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > ---
> >  commands/mount.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/commands/mount.c b/commands/mount.c
> > index ff1d8bc5e5..bb2d1d60f4 100644
> > --- a/commands/mount.c
> > +++ b/commands/mount.c
> > @@ -74,7 +74,7 @@ static int do_mount(int argc, char *argv[])
> >  		if (IS_ERR(path))
> >  			return PTR_ERR(path);
> >  
> > -		printf("mounted /dev/%s on %s\n", devstr, path);
> > +		pr_info("mounted /dev/%s on %s\n", devstr, path);
> 
> Applied all except this one. This is the output from the mount command
> and as such it should be printed with printf.

Okay, just out of curiosity. Why should we avoid pr_*() for commands?

> I have no good idea to quiesce such output as we don't have any output
> redirection. Maybe we need an additional control knob for printf output.

This would be cool :)

Regards,
  Marco

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] commands: mount: replace printf by pr_info
  2021-05-25  8:42     ` Marco Felsch
@ 2021-05-25 12:28       ` Ahmad Fatoum
  0 siblings, 0 replies; 9+ messages in thread
From: Ahmad Fatoum @ 2021-05-25 12:28 UTC (permalink / raw)
  To: Marco Felsch, Sascha Hauer; +Cc: barebox



On 25.05.21 10:42, Marco Felsch wrote:
> On 21-05-25 07:15, Sascha Hauer wrote:
>> On Fri, May 21, 2021 at 06:34:32PM +0200, Marco Felsch wrote:
>>> This allows us to control the output behaviour e.g. booting silently
>>> to improve boot time.
>>>
>>> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
>>> ---
>>>  commands/mount.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/commands/mount.c b/commands/mount.c
>>> index ff1d8bc5e5..bb2d1d60f4 100644
>>> --- a/commands/mount.c
>>> +++ b/commands/mount.c
>>> @@ -74,7 +74,7 @@ static int do_mount(int argc, char *argv[])
>>>  		if (IS_ERR(path))
>>>  			return PTR_ERR(path);
>>>  
>>> -		printf("mounted /dev/%s on %s\n", devstr, path);
>>> +		pr_info("mounted /dev/%s on %s\n", devstr, path);
>>
>> Applied all except this one. This is the output from the mount command
>> and as such it should be printed with printf.
> 
> Okay, just out of curiosity. Why should we avoid pr_*() for commands?

One thing that comes to mind: pr_ goes into log (and then into pstore),
printf doesn't.
 
>> I have no good idea to quiesce such output as we don't have any output
>> redirection. Maybe we need an additional control knob for printf output.
> 
> This would be cool :)

I've patches lying around for $(cmd) which would capture the output,
but not print it directly if you don't echo it out. Would that help
you?

Cheers,
Ahmad

> 
> Regards,
>   Marco
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-05-25 12:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-21 16:34 [PATCH 0/4] Change printf behaviour Marco Felsch
2021-05-21 16:34 ` [PATCH 1/4] commands: mount: replace printf by pr_info Marco Felsch
2021-05-25  5:15   ` Sascha Hauer
2021-05-25  8:42     ` Marco Felsch
2021-05-25 12:28       ` Ahmad Fatoum
2021-05-21 16:34 ` [PATCH 2/4] common: boot: replace printf by pr_info/warn variants Marco Felsch
2021-05-21 16:34 ` [PATCH 3/4] common: bootm: replace printf by pr_err/info Marco Felsch
2021-05-21 16:34 ` [PATCH 4/4] common: oftree: replace printf by pr_info Marco Felsch
2021-05-21 16:52 ` [PATCH 0/4] Change printf behaviour Marco Felsch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox