mbox series

[0/2] vsprintf: remove redundant %pCn format specifier

Message ID 20250307-vsprintf-pcn-v1-0-df0b2ccf610f@bootlin.com (mailing list archive)
Headers show
Series vsprintf: remove redundant %pCn format specifier | expand

Message

Luca Ceresoli March 7, 2025, 11:19 a.m. UTC
There are two printk format specifiers for clocks: %pC and %pCn, and they
print exactly the same string. The reason for having two is not totally
clear (see discussion in patch 2), but there seem to be no advantage in
having two instead of one.

Definitely having two without properly documenting they do the same creates
misunderstandings [0].

Since %pCn is used in a single place, replace it with %pC and remove %pCn
to simplify such format specifiers implementation and avoid
misunderstandings.

[0] https://lore.kernel.org/dri-devel/71c44221-b18b-4928-8faf-00893ec4a109@nxp.com/

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Luca Ceresoli (2):
      thermal: bcm2835: use %pC instead of %pCn
      vsprintf: remove redundant and unused %pCn format specifier

 Documentation/core-api/printk-formats.rst  |  3 +--
 drivers/thermal/broadcom/bcm2835_thermal.c |  2 +-
 lib/vsprintf.c                             | 10 ++--------
 3 files changed, 4 insertions(+), 11 deletions(-)
---
base-commit: 7eb172143d5508b4da468ed59ee857c6e5e01da6
change-id: 20250307-vsprintf-pcn-8a43e3b0d43e

Best regards,

Comments

Geert Uytterhoeven March 7, 2025, 12:13 p.m. UTC | #1
Hi Luca,

On Fri, 7 Mar 2025 at 12:19, Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:
> There are two printk format specifiers for clocks: %pC and %pCn, and they
> print exactly the same string. The reason for having two is not totally
> clear (see discussion in patch 2), but there seem to be no advantage in
> having two instead of one.
>
> Definitely having two without properly documenting they do the same creates
> misunderstandings [0].
>
> Since %pCn is used in a single place, replace it with %pC and remove %pCn
> to simplify such format specifiers implementation and avoid
> misunderstandings.
>
> [0] https://lore.kernel.org/dri-devel/71c44221-b18b-4928-8faf-00893ec4a109@nxp.com/

The link looks unrelated?

Gr{oetje,eeting}s,

                        Geert
Luca Ceresoli March 7, 2025, 12:30 p.m. UTC | #2
On Fri, 7 Mar 2025 13:13:19 +0100
Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> Hi Luca,
> 
> On Fri, 7 Mar 2025 at 12:19, Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:
> > There are two printk format specifiers for clocks: %pC and %pCn, and they
> > print exactly the same string. The reason for having two is not totally
> > clear (see discussion in patch 2), but there seem to be no advantage in
> > having two instead of one.
> >
> > Definitely having two without properly documenting they do the same creates
> > misunderstandings [0].
> >
> > Since %pCn is used in a single place, replace it with %pC and remove %pCn
> > to simplify such format specifiers implementation and avoid
> > misunderstandings.
> >
> > [0] https://lore.kernel.org/dri-devel/71c44221-b18b-4928-8faf-00893ec4a109@nxp.com/  
> 
> The link looks unrelated?

Wrong link, sorry. The correct one
is: https://lore.kernel.org/dri-devel/f8df2b5e-b005-4ada-8108-159b2b94a72e@nxp.com/

Luca