mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Marco Felsch <m.felsch@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 3/4] lib: hexdump: make use of pr_debug
Date: Mon, 20 Oct 2025 10:44:36 +0200	[thread overview]
Message-ID: <aPX2dGXUM9BFm4qe@pengutronix.de> (raw)
In-Reply-To: <20251017120406.1348897-3-m.felsch@pengutronix.de>

On Fri, Oct 17, 2025 at 02:03:35PM +0200, Marco Felsch wrote:
> 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@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);

pr_debug is only compiled in when DEBUG is defined. This means you have
to add a "#define DEBUG" in lib/hexdump.c to make the messages visible
printed in another file, or alternatively have to define DEBUG globally.

I think we should rather replace the const char *level argument with a
unsigned int level argument expecting one of MSG_* and use pr_print() here.

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 |



  reply	other threads:[~2025-10-20 12:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17 12:03 [PATCH 1/4] ARM: i.MX8MM: add MX8MM_PAD_CTL defines Marco Felsch
2025-10-17 12:03 ` [PATCH 2/4] lib: port CRC16 implementation from Linux Marco Felsch
2025-10-20  8:31   ` Sascha Hauer
2025-10-20  8:45     ` Marco Felsch
2025-10-17 12:03 ` [PATCH 3/4] lib: hexdump: make use of pr_debug Marco Felsch
2025-10-20  8:44   ` Sascha Hauer [this message]
2025-10-20  8:49     ` Marco Felsch
2025-10-20  9:02       ` Sascha Hauer
2025-10-20  9:27         ` Marco Felsch
2025-10-17 12:03 ` [PATCH 4/4] aiodev: add missing headers Marco Felsch
2025-10-20  8:45   ` (subset) " Sascha Hauer

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=aPX2dGXUM9BFm4qe@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=m.felsch@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox