aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/vsprintf.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 8f29af063d8a..0c23b006b495 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -693,6 +693,11 @@ char *symbol_string(char *buf, char *end, void *ptr,
693#endif 693#endif
694} 694}
695 695
696static const struct printf_spec default_str_spec = {
697 .field_width = -1,
698 .precision = -1,
699};
700
696static const struct printf_spec default_dec_spec = { 701static const struct printf_spec default_dec_spec = {
697 .base = 10, 702 .base = 10,
698 .precision = -1, 703 .precision = -1,
@@ -1461,10 +1466,6 @@ char *format_flags(char *buf, char *end, unsigned long flags,
1461 const struct trace_print_flags *names) 1466 const struct trace_print_flags *names)
1462{ 1467{
1463 unsigned long mask; 1468 unsigned long mask;
1464 const struct printf_spec strspec = {
1465 .field_width = -1,
1466 .precision = -1,
1467 };
1468 const struct printf_spec numspec = { 1469 const struct printf_spec numspec = {
1469 .flags = SPECIAL|SMALL, 1470 .flags = SPECIAL|SMALL,
1470 .field_width = -1, 1471 .field_width = -1,
@@ -1477,7 +1478,7 @@ char *format_flags(char *buf, char *end, unsigned long flags,
1477 if ((flags & mask) != mask) 1478 if ((flags & mask) != mask)
1478 continue; 1479 continue;
1479 1480
1480 buf = string(buf, end, names->name, strspec); 1481 buf = string(buf, end, names->name, default_str_spec);
1481 1482
1482 flags &= ~mask; 1483 flags &= ~mask;
1483 if (flags) { 1484 if (flags) {
@@ -1535,22 +1536,18 @@ char *device_node_gen_full_name(const struct device_node *np, char *buf, char *e
1535{ 1536{
1536 int depth; 1537 int depth;
1537 const struct device_node *parent = np->parent; 1538 const struct device_node *parent = np->parent;
1538 static const struct printf_spec strspec = {
1539 .field_width = -1,
1540 .precision = -1,
1541 };
1542 1539
1543 /* special case for root node */ 1540 /* special case for root node */
1544 if (!parent) 1541 if (!parent)
1545 return string(buf, end, "/", strspec); 1542 return string(buf, end, "/", default_str_spec);
1546 1543
1547 for (depth = 0; parent->parent; depth++) 1544 for (depth = 0; parent->parent; depth++)
1548 parent = parent->parent; 1545 parent = parent->parent;
1549 1546
1550 for ( ; depth >= 0; depth--) { 1547 for ( ; depth >= 0; depth--) {
1551 buf = string(buf, end, "/", strspec); 1548 buf = string(buf, end, "/", default_str_spec);
1552 buf = string(buf, end, device_node_name_for_depth(np, depth), 1549 buf = string(buf, end, device_node_name_for_depth(np, depth),
1553 strspec); 1550 default_str_spec);
1554 } 1551 }
1555 return buf; 1552 return buf;
1556} 1553}