lib/vsnprintf: Add %par specifier for sake of consistency
Subsystems (3)
Andy Shevchenko
reviewerPATCH v2 1/1 lib/vsnprintf: Add %par specifier for sake of consistency
While resource_size_t is repeating phys_addr_t, allocate %par specifier for that type for sake of consistency.
---
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(-)
Documentation/printk-formats.txt +10 -3
@@ -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:
lib/vsprintf.c +9 -2
@@ -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)
Signature · 1 line
2.11.0
Andrew Morton
maintainerQuoted 3 lines · On Wed, 11 Jan 2017 18:28:07 +0200 Andy Shevchenko…
While
resource_size_tis repeatingphys_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.
Quoted 6 lines · Andrew Morton
Quoted 3 lines · On Wed, 11 Jan 2017 18:28:07 +0200 Andy Shevchenko…
While
resource_size_tis repeatingphys_addr_t, allocate %par specifier for that type for sake of consistency.
Quoted 6 lines
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?
Andy Shevchenko
reviewerQuoted 13 lines · Joe Perches
Quoted 12 lines · Andrew Morton
Quoted 4 lines · On Wed, 11 Jan 2017 18:28:07 +0200 Andy Shevchenko <andriy.shevchenk…
While
resource_size_tis repeatingphys_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.
Quoted 5 lines
Quoted 2 lines
Are there callsites which should be converted? If so, a patch which does at least some of those would be helpful.
A
resource_size_tisn't a different size than aphys_addr_t. Not so far anyway.
Yeah, I know.
Quoted 6 lines
$ 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.
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy