Commit 5b17aecf authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Linus Torvalds

lib/vsprintf: factor out %pN[F] handler as netdev_bits()

Move switch case to the netdev_features_string() and rename it to
netdev_bits().  In the future we can extend it as needed.

Here we replace the fallback of %pN from '%p' with possible flags to
sticter '0x%p' without any flags variation.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3cab1e71
...@@ -1345,11 +1345,22 @@ char *uuid_string(char *buf, char *end, const u8 *addr, ...@@ -1345,11 +1345,22 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
return string(buf, end, uuid, spec); return string(buf, end, uuid, spec);
} }
static static noinline_for_stack
char *netdev_feature_string(char *buf, char *end, const void *addr) char *netdev_bits(char *buf, char *end, const void *addr, const char *fmt)
{ {
unsigned long long num = *(const netdev_features_t *)addr; unsigned long long num;
int size = sizeof(netdev_features_t); int size;
switch (fmt[1]) {
case 'F':
num = *(const netdev_features_t *)addr;
size = sizeof(netdev_features_t);
break;
default:
num = (unsigned long)addr;
size = sizeof(unsigned long);
break;
}
return special_hex_number(buf, end, num, size); return special_hex_number(buf, end, num, size);
} }
...@@ -1621,11 +1632,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, ...@@ -1621,11 +1632,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
break; break;
case 'N': case 'N':
switch (fmt[1]) { return netdev_bits(buf, end, ptr, fmt);
case 'F':
return netdev_feature_string(buf, end, ptr);
}
break;
case 'a': case 'a':
return address_val(buf, end, ptr, fmt); return address_val(buf, end, ptr, fmt);
case 'd': case 'd':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment