summaryrefslogtreecommitdiffstats
path: root/lib/vsprintf.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2016-01-15 19:59:20 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-16 14:17:30 -0500
commit5b17aecfcdd3dc82c237677f5efc9a44deeaa39e (patch)
tree65ce5228484a92bdc058e66dbff2324b5d63fbaa /lib/vsprintf.c
parent3cab1e711297c4fbc526ca9b802ef61894c06545 (diff)
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: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r--lib/vsprintf.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index b30203b00adf..48ff9c36644d 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1345,11 +1345,22 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
1345 return string(buf, end, uuid, spec); 1345 return string(buf, end, uuid, spec);
1346} 1346}
1347 1347
1348static 1348static noinline_for_stack
1349char *netdev_feature_string(char *buf, char *end, const void *addr) 1349char *netdev_bits(char *buf, char *end, const void *addr, const char *fmt)
1350{ 1350{
1351 unsigned long long num = *(const netdev_features_t *)addr; 1351 unsigned long long num;
1352 int size = sizeof(netdev_features_t); 1352 int size;
1353
1354 switch (fmt[1]) {
1355 case 'F':
1356 num = *(const netdev_features_t *)addr;
1357 size = sizeof(netdev_features_t);
1358 break;
1359 default:
1360 num = (unsigned long)addr;
1361 size = sizeof(unsigned long);
1362 break;
1363 }
1353 1364
1354 return special_hex_number(buf, end, num, size); 1365 return special_hex_number(buf, end, num, size);
1355} 1366}
@@ -1621,11 +1632,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
1621 break; 1632 break;
1622 1633
1623 case 'N': 1634 case 'N':
1624 switch (fmt[1]) { 1635 return netdev_bits(buf, end, ptr, fmt);
1625 case 'F':
1626 return netdev_feature_string(buf, end, ptr);
1627 }
1628 break;
1629 case 'a': 1636 case 'a':
1630 return address_val(buf, end, ptr, fmt); 1637 return address_val(buf, end, ptr, fmt);
1631 case 'd': 1638 case 'd':