linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] lib/vsnprintf: Add %par specifier for sake of consistency
@ 2016-12-01  1:43 Andy Shevchenko
  2016-12-27 11:41 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2016-12-01  1:43 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel; +Cc: Andy Shevchenko

While resource_size_t is repeating phys_addr_t, allocate %par specifier for
that type for sake of consistency.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 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)
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 1/1] lib/vsnprintf: Add %par specifier for sake of consistency
  2016-12-01  1:43 [PATCH v1 1/1] lib/vsnprintf: Add %par specifier for sake of consistency Andy Shevchenko
@ 2016-12-27 11:41 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2016-12-27 11:41 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel

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@linux.intel.com>
> ---
>  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@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-27 11:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-01  1:43 [PATCH v1 1/1] lib/vsnprintf: Add %par specifier for sake of consistency Andy Shevchenko
2016-12-27 11:41 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).