diff mbox series

[v3,40/43] log: Support outputing function names in SPL

Message ID 20230504225829.2537050-9-sjg@chromium.org
State Superseded
Delegated to: Bin Meng
Headers show
Series x86: Use qemu-x86_64 to boot EFI installers | expand

Commit Message

Simon Glass May 4, 2023, 10:58 p.m. UTC
The output is garbled when tiny printf() is used. Correct this by adding
a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v2)

Changes in v2:
- Add new patch to support outputing function names in SPL

 common/log_console.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/common/log_console.c b/common/log_console.c
index f1dcc04b97c..bb091ce21a4 100644
--- a/common/log_console.c
+++ b/common/log_console.c
@@ -37,8 +37,14 @@  static int log_console_emit(struct log_device *ldev, struct log_rec *rec)
 			printf("%s:", rec->file);
 		if (fmt & BIT(LOGF_LINE))
 			printf("%d-", rec->line);
-		if (fmt & BIT(LOGF_FUNC))
-			printf("%*s()", CONFIG_LOGF_FUNC_PAD, rec->func);
+		if (fmt & BIT(LOGF_FUNC)) {
+			if (CONFIG_IS_ENABLED(USE_TINY_PRINTF)) {
+				printf("%s()", rec->func);
+			} else {
+				printf("%*s()", CONFIG_LOGF_FUNC_PAD,
+				       rec->func);
+			}
+		}
 	}
 	if (fmt & BIT(LOGF_MSG))
 		printf("%s%s", add_space ? " " : "", rec->msg);