From: "Michael Walle" <mwalle@kernel.org>
To: "Tom Rini" <trini@konsulko.com>
Cc: "Christoph Niedermaier" <cniedermaier@dh-electronics.com>,
"Quentin Schulz" <quentin.schulz@cherry.de>,
"Marek Vasut" <marex@denx.de>,
"u-boot@lists.denx.de" <u-boot@lists.denx.de>,
"Benedikt Spranger" <b.spranger@linutronix.de>,
"Simon Glass" <sjg@chromium.org>,
"John Ogness" <john.ogness@linutronix.de>,
"Jerome Forissier" <jerome.forissier@linaro.org>,
"Ilias Apalodimas" <ilias.apalodimas@linaro.org>
Subject: Re: [PATCH] tiny-printf: Add support for upper case hex values
Date: Mon, 07 Apr 2025 07:27:50 +0200 [thread overview]
Message-ID: <D905PDKW5YBK.34KA6NCU8GLWB@kernel.org> (raw)
In-Reply-To: <20250404145856.GR5495@bill-the-cat>
[-- Attachment #1: Type: text/plain, Size: 1941 bytes --]
Hi,
> > > > I wouldn't mind printing the pointer for %p[mMI], but %pa prints the
> > > > *content* of the pointer which is really confusing. I.e. in
> > > > pinctrl-single.c the reg value pairs are printed like
> > > >
> > > > dev_dbg(dev, "reg/val %pa/0x%08x\n", ®, val);
> > > >
> > > > with reg being a pointer to a physical address. So with tiny_printf
> > > > the address of reg (which is a pointer to the stack) is printed in
> > > > this case.
> > > >
> > > > I don't think we can print %p without putting more logic into the
> > > > decoding. I think the culprit here is the fallthrough to %x, which
> > > > then leads to the confusing behavior shown above. IMHO if we want to
> > > > avoid that, we'd have to make %p entirely unsupported.
> > > >
> > > > diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
> > > > index faf55d7f327..8147ffa2c1b 100644
> > > > --- a/lib/tiny-printf.c
> > > > +++ b/lib/tiny-printf.c
> > > > @@ -269,21 +269,18 @@ static int _vprintf(struct printf_info *info, const char *fmt,
> > > > va_list va)
> > > > div_out(info, &num, div);
> > > > }
> > > > break;
> > > > +#if CONFIG_IS_ENABLED(NET) || CONFIG_IS_ENABLED(NET_LWIP) || _DEBUG
> > >
> > > What if we fine-tune tinyprinf via config here?
> > > For example SPL_USE_TINY_PRINTF_POINTER_SUPPORT and
> > > select it by NET or NET_LWIP. If someone needs it,
> > > the pointer output can be enabled, otherwise '?' for
> > > unsupported is output.
> >
> > Yeah I had a similar idea, but I'm not sure if yet another config
> > symbol is worth it. That's up to the maintainer to decide :)
> >
> > In any case, we have a different behavior to what is printed
> > right now, as we drop the fallthrough to %x. Tom? Simon?
>
> A Kconfig symbol that NET||NET_LWIP select seems fine, and fall through
> to printing "?".
Great! Christoph, will you prepare a patch or should I?
-michael
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
next prev parent reply other threads:[~2025-04-07 5:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-20 10:23 [PATCH] tiny-printf: Add support for upper case hex values Christoph Niedermaier
2025-03-20 11:49 ` Marek Vasut
2025-03-20 13:53 ` Tom Rini
2025-03-20 14:00 ` Quentin Schulz
2025-03-20 14:14 ` Marek Vasut
2025-03-20 14:18 ` Tom Rini
2025-03-20 17:58 ` Christoph Niedermaier
2025-03-20 18:28 ` Tom Rini
2025-03-20 18:41 ` Christoph Niedermaier
2025-04-01 8:55 ` Michael Walle
2025-04-01 14:08 ` Christoph Niedermaier
2025-04-02 7:01 ` Michael Walle
2025-04-02 9:03 ` Christoph Niedermaier
2025-04-04 8:33 ` Michael Walle
2025-04-04 14:58 ` Tom Rini
2025-04-07 5:27 ` Michael Walle [this message]
2025-04-07 6:55 ` Christoph Niedermaier
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=D905PDKW5YBK.34KA6NCU8GLWB@kernel.org \
--to=mwalle@kernel.org \
--cc=b.spranger@linutronix.de \
--cc=cniedermaier@dh-electronics.com \
--cc=ilias.apalodimas@linaro.org \
--cc=jerome.forissier@linaro.org \
--cc=john.ogness@linutronix.de \
--cc=marex@denx.de \
--cc=quentin.schulz@cherry.de \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.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