From: Sam Protsenko <semen.protsenko@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC 2/2] env: Add prefix to error messages when loading env
Date: Wed, 18 Jul 2018 01:09:12 +0300 [thread overview]
Message-ID: <20180717220912.11358-2-semen.protsenko@linaro.org> (raw)
In-Reply-To: <20180717220912.11358-1-semen.protsenko@linaro.org>
This is just a draft to discuss ideas related to "Make U-Boot log great
again" thread.
With this patch we will see something like:
Loading Environment from FAT...
--> MMC: no card present
--> ** Bad device mmc 0 **
--> Failed (-5)
Loading Environment from MMC...
--> OK
instead of:
Loading Environment from FAT... MMC: no card present
** Bad device mmc 0 **
Failed (-5)
Loading Environment from MMC... OK
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
---
common/console.c | 8 ++++++++
env/env.c | 4 +++-
include/asm-generic/global_data.h | 1 +
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/common/console.c b/common/console.c
index 2ba33dc574..1bbafa33a1 100644
--- a/common/console.c
+++ b/common/console.c
@@ -533,6 +533,14 @@ void putc(const char c)
void puts(const char *s)
{
+ if (gd->pr_prefix) {
+ const char *prefix = gd->pr_prefix;
+
+ gd->pr_prefix = NULL;
+ puts(prefix);
+ gd->pr_prefix = prefix;
+ }
+
#ifdef CONFIG_DEBUG_UART
if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
while (*s) {
diff --git a/env/env.c b/env/env.c
index 5c0842ac07..56a105ea55 100644
--- a/env/env.c
+++ b/env/env.c
@@ -194,12 +194,14 @@ int env_load(void)
if (!env_has_inited(drv->location))
continue;
- printf("Loading Environment from %s... ", drv->name);
+ printf("Loading Environment from %s...\n", drv->name);
+ gd->pr_prefix = " --> ";
ret = drv->load();
if (ret)
printf("Failed (%d)\n", ret);
else
printf("OK\n");
+ gd->pr_prefix = NULL;
if (!ret)
return 0;
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 0fd4900392..32b80db96b 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -44,6 +44,7 @@ typedef struct global_data {
unsigned long board_type;
#endif
unsigned long have_console; /* serial_init() was called */
+ const char *pr_prefix; /* print prefix before message */
#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
unsigned long precon_buf_idx; /* Pre-Console buffer index */
#endif
--
2.18.0
next prev parent reply other threads:[~2018-07-17 22:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-17 22:09 [U-Boot] [RFC 1/2] env: Drop error messages when loading environment Sam Protsenko
2018-07-17 22:09 ` Sam Protsenko [this message]
2018-07-18 6:23 ` [U-Boot] [RFC 2/2] env: Add prefix to error messages when loading env Wolfgang Denk
2018-07-18 12:53 ` Tom Rini
2018-07-18 13:04 ` Sam Protsenko
2018-07-18 14:28 ` Tom Rini
2018-07-18 14:09 ` Wolfgang Denk
2018-07-19 12:52 ` Tom Rini
2018-07-19 13:12 ` Sam Protsenko
2018-07-19 19:52 ` Wolfgang Denk
2018-07-19 20:16 ` Sam Protsenko
2018-07-19 19:49 ` Wolfgang Denk
2018-07-18 6:19 ` [U-Boot] [RFC 1/2] env: Drop error messages when loading environment Wolfgang Denk
2018-07-18 12:50 ` Sam Protsenko
2018-07-18 12:51 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180717220912.11358-2-semen.protsenko@linaro.org \
--to=semen.protsenko@linaro.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.