Re: [PATCH -next] dma-debug: Use %pa to format phys_addr_t

From: Geert Uytterhoeven
Date: Thu Mar 30 2023 - 03:07:54 EST


Hi Christoph,

On Thu, Mar 30, 2023 at 1:50 AM Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
> I've applied this as it is the first fix I got into my mailbox for it.

Thank you!

> Arnd sent one a little later, which uses %pap instead of %pa, which
> confused me a bit. The documentation seems to allow both without
> any recommendation which one to use, which confuses me even further.

The "%pa" class supports two variants: "%pad" (for dma_addr_t) and
"%pap" (for phys_addr_t). "%pa" is a shortcut for the latter, cfr.
https://elixir.bootlin.com/linux/latest/source/lib/vsprintf.c#L1792

The default exists because "%pa" was fist, cfr. commit aaf07621b8bbfdc0
("vsprintf: add %pad extension for dma_addr_t use"), and I don't think
we can easily remove it. The default is shorter (saves one byte, even
compared to %llx"), so why not use it?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds