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 11:02:05 +0200	[thread overview]
Message-ID: <aPX6jRJmQDcVRudV@pengutronix.de> (raw)
In-Reply-To: <20251020084924.6ytubm6byqw22iw3@pengutronix.de>

On Mon, Oct 20, 2025 at 10:49:24AM +0200, Marco Felsch wrote:
> On 25-10-20, Sascha Hauer wrote:
> > 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.
> 
> Yep, this is true and I forgot about that drawback :/
> 
> > 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.
> 
> What about keeping the Linux API but converting it back to int?

Not possible:

#define KERN_EMERG      ""   /* system is unusable                   */
#define KERN_ALERT      ""   /* action must be taken immediately     */
#define KERN_CRIT       ""   /* critical conditions                  */
#define KERN_ERR        ""   /* error conditions                     */
#define KERN_WARNING    ""   /* warning conditions                   */
#define KERN_NOTICE     ""   /* normal but significant condition     */
#define KERN_INFO       ""   /* informational                        */
#define KERN_DEBUG      ""   /* debug-level messages                 */

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
2025-10-20  8:49     ` Marco Felsch
2025-10-20  9:02       ` Sascha Hauer [this message]
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=aPX6jRJmQDcVRudV@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