diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/vsprintf.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index d7a708f82559..8f29af063d8a 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 | ||
| 696 | static const struct printf_spec default_dec_spec = { | ||
| 697 | .base = 10, | ||
| 698 | .precision = -1, | ||
| 699 | }; | ||
| 700 | |||
| 696 | static noinline_for_stack | 701 | static noinline_for_stack |
| 697 | char *resource_string(char *buf, char *end, struct resource *res, | 702 | char *resource_string(char *buf, char *end, struct resource *res, |
| 698 | struct printf_spec spec, const char *fmt) | 703 | struct printf_spec spec, const char *fmt) |
| @@ -722,11 +727,6 @@ char *resource_string(char *buf, char *end, struct resource *res, | |||
| 722 | .precision = -1, | 727 | .precision = -1, |
| 723 | .flags = SMALL | ZEROPAD, | 728 | .flags = SMALL | ZEROPAD, |
| 724 | }; | 729 | }; |
| 725 | static const struct printf_spec dec_spec = { | ||
| 726 | .base = 10, | ||
| 727 | .precision = -1, | ||
| 728 | .flags = 0, | ||
| 729 | }; | ||
| 730 | static const struct printf_spec str_spec = { | 730 | static const struct printf_spec str_spec = { |
| 731 | .field_width = -1, | 731 | .field_width = -1, |
| 732 | .precision = 10, | 732 | .precision = 10, |
| @@ -760,10 +760,10 @@ char *resource_string(char *buf, char *end, struct resource *res, | |||
| 760 | specp = &mem_spec; | 760 | specp = &mem_spec; |
| 761 | } else if (res->flags & IORESOURCE_IRQ) { | 761 | } else if (res->flags & IORESOURCE_IRQ) { |
| 762 | p = string(p, pend, "irq ", str_spec); | 762 | p = string(p, pend, "irq ", str_spec); |
| 763 | specp = &dec_spec; | 763 | specp = &default_dec_spec; |
| 764 | } else if (res->flags & IORESOURCE_DMA) { | 764 | } else if (res->flags & IORESOURCE_DMA) { |
| 765 | p = string(p, pend, "dma ", str_spec); | 765 | p = string(p, pend, "dma ", str_spec); |
| 766 | specp = &dec_spec; | 766 | specp = &default_dec_spec; |
| 767 | } else if (res->flags & IORESOURCE_BUS) { | 767 | } else if (res->flags & IORESOURCE_BUS) { |
| 768 | p = string(p, pend, "bus ", str_spec); | 768 | p = string(p, pend, "bus ", str_spec); |
| 769 | specp = &bus_spec; | 769 | specp = &bus_spec; |
| @@ -903,9 +903,6 @@ char *bitmap_list_string(char *buf, char *end, unsigned long *bitmap, | |||
| 903 | int cur, rbot, rtop; | 903 | int cur, rbot, rtop; |
| 904 | bool first = true; | 904 | bool first = true; |
| 905 | 905 | ||
| 906 | /* reused to print numbers */ | ||
| 907 | spec = (struct printf_spec){ .base = 10 }; | ||
| 908 | |||
| 909 | rbot = cur = find_first_bit(bitmap, nr_bits); | 906 | rbot = cur = find_first_bit(bitmap, nr_bits); |
| 910 | while (cur < nr_bits) { | 907 | while (cur < nr_bits) { |
| 911 | rtop = cur; | 908 | rtop = cur; |
| @@ -920,13 +917,13 @@ char *bitmap_list_string(char *buf, char *end, unsigned long *bitmap, | |||
| 920 | } | 917 | } |
| 921 | first = false; | 918 | first = false; |
| 922 | 919 | ||
| 923 | buf = number(buf, end, rbot, spec); | 920 | buf = number(buf, end, rbot, default_dec_spec); |
| 924 | if (rbot < rtop) { | 921 | if (rbot < rtop) { |
| 925 | if (buf < end) | 922 | if (buf < end) |
| 926 | *buf = '-'; | 923 | *buf = '-'; |
| 927 | buf++; | 924 | buf++; |
| 928 | 925 | ||
| 929 | buf = number(buf, end, rtop, spec); | 926 | buf = number(buf, end, rtop, default_dec_spec); |
| 930 | } | 927 | } |
| 931 | 928 | ||
| 932 | rbot = cur; | 929 | rbot = cur; |
