Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1556702 > unrolled thread

[PATCH v2 1/1] lib/vsnprintf: Add %par specifier for sake of consistency

Started byAndy Shevchenko <andriy.shevchenko@linux.intel.com>
First post2017-01-11 17:40 +0100
Last post2017-01-12 12:20 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 1/1] lib/vsnprintf: Add %par specifier for sake of consistency Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-01-11 17:40 +0100
    Re: [PATCH v2 1/1] lib/vsnprintf: Add %par specifier for sake of  consistency Andrew Morton <akpm@linux-foundation.org> - 2017-01-12 01:00 +0100
      Re: [PATCH v2 1/1] lib/vsnprintf: Add %par specifier for sake of  consistency Joe Perches <joe@perches.com> - 2017-01-12 02:00 +0100
        Re: [PATCH v2 1/1] lib/vsnprintf: Add %par specifier for sake of  consistency Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-01-12 12:20 +0100

#1556702 — [PATCH v2 1/1] lib/vsnprintf: Add %par specifier for sake of consistency

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2017-01-11 17:40 +0100
Subject[PATCH v2 1/1] lib/vsnprintf: Add %par specifier for sake of consistency
Message-ID<sYu6l-Lo-21@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1557017 — Re: [PATCH v2 1/1] lib/vsnprintf: Add %par specifier for sake of consistency

FromAndrew Morton <akpm@linux-foundation.org>
Date2017-01-12 01:00 +0100
SubjectRe: [PATCH v2 1/1] lib/vsnprintf: Add %par specifier for sake of consistency
Message-ID<sYAYe-54i-7@gated-at.bofh.it>
In reply to#1556702
On Wed, 11 Jan 2017 18:28:07 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

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

I'm struggling to see the value in this.  A more detailed changelog
would help, explaining why you think the kernel would benefit from
this.

Are there callsites which should be converted?  If so, a patch which
does at least some of those would be helpful.

[toc] | [prev] | [next] | [standalone]


#1557036 — Re: [PATCH v2 1/1] lib/vsnprintf: Add %par specifier for sake of consistency

FromJoe Perches <joe@perches.com>
Date2017-01-12 02:00 +0100
SubjectRe: [PATCH v2 1/1] lib/vsnprintf: Add %par specifier for sake of consistency
Message-ID<sYBUe-5BX-11@gated-at.bofh.it>
In reply to#1557017
On Wed, 2017-01-11 at 15:57 -0800, Andrew Morton wrote:
> On Wed, 11 Jan 2017 18:28:07 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > While resource_size_t is repeating phys_addr_t, allocate %par specifier for
> > that type for sake of consistency.
> > 
> 
> I'm struggling to see the value in this.  A more detailed changelog
> would help, explaining why you think the kernel would benefit from
> this.
> 
> Are there callsites which should be converted?  If so, a patch which
> does at least some of those would be helpful.

A resource_size_t isn't a different size than a phys_addr_t.
Not so far anyway.

$ git grep typedef.*resource_size_t include
include/linux/types.h:typedef phys_addr_t resource_size_t;

Is there an arch that needs a different size?
If not, why add another case?
Just to make the kernel larger?

[toc] | [prev] | [next] | [standalone]


#1557367 — Re: [PATCH v2 1/1] lib/vsnprintf: Add %par specifier for sake of consistency

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2017-01-12 12:20 +0100
SubjectRe: [PATCH v2 1/1] lib/vsnprintf: Add %par specifier for sake of consistency
Message-ID<sYLAd-3jp-9@gated-at.bofh.it>
In reply to#1557036
On Wed, 2017-01-11 at 16:59 -0800, Joe Perches wrote:
> On Wed, 2017-01-11 at 15:57 -0800, Andrew Morton wrote:
> > On Wed, 11 Jan 2017 18:28:07 +0200 Andy Shevchenko <andriy.shevchenk
> > o@linux.intel.com> wrote:
> > 
> > > While resource_size_t is repeating phys_addr_t, allocate %par
> > > specifier for
> > > that type for sake of consistency.
> > > 
> > 
> > I'm struggling to see the value in this.  A more detailed changelog
> > would help, explaining why you think the kernel would benefit from
> > this.
> > 
> > Are there callsites which should be converted?  If so, a patch which
> > does at least some of those would be helpful.
> 
> A resource_size_t isn't a different size than a phys_addr_t.
> Not so far anyway.

Yeah, I know.

> $ git grep typedef.*resource_size_t include
> include/linux/types.h:typedef phys_addr_t resource_size_t;
> 
> Is there an arch that needs a different size?
> If not, why add another case?
> Just to make the kernel larger?

Andrew, Joe, thanks for your comments. That's what I asked for in v1.

Just drop the patch. I got my answers.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web