Re: [PATCH v1 1/2] vsprintf: Add %pR human-readable size

Andy Shevchenko <[email protected]>
Newsgroups org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci
Organization Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo
Message-ID <[email protected]>
On Sat, Aug 08, 2026 at 12:23:07PM -0500, Bjorn Helgaas wrote:
> Include human-readable size when printing struct resource memory ranges
> (not including DMA, bus number, or I/O port ranges) with the %pR format to
> make it easier to read, e.g.,
> 
>   - pci 0000:00:02.0: BAR 0 [mem 0xfea80000-0xfea9ffff]
>   + pci 0000:00:02.0: BAR 0 [mem 0xfea80000-0xfea9ffff (128 KiB)]

...

>  lib/vsprintf.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)

Sorry, we do not accept this without added test cases.

...

> +	if (res->flags & IORESOURCE_MEM) {

Besides we have resource_type() macro, why only this? I would expect IO as well
as 64-bit MEM version.

> +		*p++ = ' ';
> +		*p++ = '(';
> +		string_get_size(resource_size(res), 1, STRING_UNITS_2,
> +				size_buf, sizeof(size_buf));

> +		p = string_nocheck(p, pend, size_buf, str_spec);

Why do you need this? Use returned value from string_get_size() directly.

> +		*p++ = ')';
> +	}

-- 
With Best Regards,
Andy Shevchenko
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.