[PATCH 3/4] lib: hexdump: make use of pr_debug
Marco Felsch
m.felsch at pengutronix.de
Fri Oct 17 05:03:35 PDT 2025
The hexdump library was ported from Linux which supports different
printk() level. Because the barebox print* facility is different
compared to the one from Linux the barebox printk() doesn't support
levels. Therefore the level is always set to an empty string.
Furthermore all barebox printk() calls aren't recorded by the internal
barebox_logbuf because they are mostly used for command prints. Linux on
the other hand record each printk() print.
Not recording the output can be an issue on systems which don't have a
hw-console but a USB-ACM console, because the hexdump call may already
occurred before the console was ready.
Make use of pr_debug() instead to record the output within the
barebox_logbuf to be available later on via dmesg. Using pr_debug()
should be fine since it is mostly used for debugging/development
purpose.
Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
lib/hexdump.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/lib/hexdump.c b/lib/hexdump.c
index 940c4eec64e9..ab5e3cf727ec 100644
--- a/lib/hexdump.c
+++ b/lib/hexdump.c
@@ -284,16 +284,13 @@ void dev_print_hex_dump(struct device *dev, const char *level,
switch (prefix_type) {
case DUMP_PREFIX_ADDRESS:
- printk("%s%s%s%p: %s\n", level, name, prefix_str,
- ptr + i, linebuf);
+ pr_debug("%s%s%p: %s\n", name, prefix_str, ptr + i, linebuf);
break;
case DUMP_PREFIX_OFFSET:
- printk("%s%s%s%.8x: %s\n", level, name, prefix_str,
- i, linebuf);
+ pr_debug("%s%s%.8x: %s\n", name, prefix_str, i, linebuf);
break;
default:
- printk("%s%s%s%s\n", level, name, prefix_str,
- linebuf);
+ pr_debug("%s%s%s\n", name, prefix_str, linebuf);
break;
}
}
--
2.47.3
More information about the barebox
mailing list