[PATCH] pbl: Implement dev_printf()

Sascha Hauer s.hauer at pengutronix.de
Thu Mar 23 04:51:17 PDT 2023


Using dev_err() and friends in PBL results in undefined references.
Implement dev_printf() for PBL to avoid that. Just ignore the dev
argument here as it's likely not intialized in PBL.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 pbl/console.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/pbl/console.c b/pbl/console.c
index a147e2a19e..1a6e839c15 100644
--- a/pbl/console.c
+++ b/pbl/console.c
@@ -79,6 +79,21 @@ int pr_print(int level, const char *fmt, ...)
 	return i;
 }
 
+int dev_printf(int level, const struct device *dev, const char *fmt, ...)
+{
+	va_list args;
+	uint i;
+	char printbuffer[CFG_PBSIZE];
+
+	va_start(args, fmt);
+	i = vsnprintf(printbuffer, sizeof(printbuffer), fmt, args);
+	va_end(args);
+
+	console_puts(CONSOLE_STDERR, printbuffer);
+
+	return i;
+}
+
 int ctrlc(void)
 {
 	return 0;
-- 
2.30.2




More information about the barebox mailing list