Re: [PATCH v1 1/1] lib/vsnprintf: Add %par specifier for sake of consistency
From: Andy Shevchenko
Date: Tue Dec 27 2016 - 06:41:47 EST
On Thu, 2016-12-01 at 03:43 +0200, Andy Shevchenko wrote:
> While resource_size_t is repeating phys_addr_t, allocate %par
> specifier for
> that type for sake of consistency.
Does it make sense to anyone?
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
> ÂDocumentation/printk-formats.txt | 13 ++++++++++---
> Âlib/vsprintf.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 11 +++++++++--
> Â2 files changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/printk-formats.txt b/Documentation/printk-
> formats.txt
> index 5962949..d8c40c3 100644
> --- a/Documentation/printk-formats.txt
> +++ b/Documentation/printk-formats.txt
> @@ -79,9 +79,16 @@ Physical addresses types phys_addr_t:
> Â
> Â %pa[p] 0x01234567 or 0x0123456789abcdef
> Â
> - For printing a phys_addr_t type (and its derivatives, such as
> - resource_size_t) which can vary based on build options,
> regardless of
> - the width of the CPU data path. Passed by reference.
> + For printing a phys_addr_t type which can vary based on build
> options,
> + regardless of the width of the CPU data path. Passed by
> reference.
> +
> +Resource size types resource_size_t:
> +
> + %par 0x01234567 or 0x0123456789abcdef
> +
> + For printing a resource_size_t type which can vary based on
> build
> + options, regardless of the width of the CPU data path. Passed
> by
> + reference.
> Â
> ÂDMA addresses types dma_addr_t:
> Â
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 0967771..c89c57d 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1373,6 +1373,10 @@ char *address_val(char *buf, char *end, const
> void *addr, const char *fmt)
> Â num = *(const dma_addr_t *)addr;
> Â size = sizeof(dma_addr_t);
> Â break;
> + case 'r':
> + num = *(const resource_size_t *)addr;
> + size = sizeof(resource_size_t);
> + break;
> Â case 'p':
> Â default:
> Â num = *(const phys_addr_t *)addr;
> @@ -1548,8 +1552,11 @@ int kptr_restrict __read_mostly;
> Â *ÂÂÂÂÂÂÂÂÂÂÂÂÂÂN no separator
> Â *ÂÂÂÂÂÂÂÂÂÂÂÂThe maximum supported length is 64 bytes of the input.
> Consider
> Â *ÂÂÂÂÂÂÂÂÂÂÂÂto use print_hex_dump() for the larger input.
> - * - 'a[pd]' For address types [p] phys_addr_t, [d] dma_addr_t and
> derivatives
> - *ÂÂÂÂÂÂÂÂÂÂÂ(default assumed to be phys_addr_t, passed by reference)
> + * - 'a[dpr]' For address types (default assumed to be phys_addr_t,
> passed by
> + *ÂÂÂÂÂÂÂÂÂÂÂÂreference):
> + *ÂÂÂÂÂÂÂÂÂÂÂÂ[d] dma_addr_t
> + *ÂÂÂÂÂÂÂÂÂÂÂÂ[p] phys_addr_t
> + *ÂÂÂÂÂÂÂÂÂÂÂÂ[r] resource_size_t
> Â * - 'd[234]' For a dentry name (optionally 2-4 last components)
> Â * - 'D[234]' Same as 'd' but for a struct file
> Â * - 'g' For block_device name (gendisk + partition number)
--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy