public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux@rasmusvillemoes.dk,
	arnd.bergmann@linaro.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v2 1/1] lib/vsnprintf: Add %par specifier for sake of consistency
Date: Wed, 11 Jan 2017 18:28:07 +0200	[thread overview]
Message-ID: <20170111162807.45736-1-andriy.shevchenko@linux.intel.com> (raw)

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>
---
In v2:
- rebase on top of latest linux-next
- include more people to Cc list
 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 5962949944fd..d8c40c30118a 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 c771444f3ae4..ca2b32adc124 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1370,6 +1370,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;
@@ -1545,8 +1549,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.11.0

             reply	other threads:[~2017-01-11 16:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-11 16:28 Andy Shevchenko [this message]
2017-01-11 23:57 ` [PATCH v2 1/1] lib/vsnprintf: Add %par specifier for sake of consistency Andrew Morton
2017-01-12  0:59   ` Joe Perches
2017-01-12 11:18     ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170111162807.45736-1-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd.bergmann@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox