Merge branch 'akpm' (patches from Andrew)
[platform/kernel/linux-rpi.git] / lib / vsprintf.c
index d7ad44f..58d5e56 100644 (file)
@@ -53,8 +53,7 @@
 #include <linux/string_helpers.h>
 #include "kstrtox.h"
 
-static unsigned long long simple_strntoull(const char *startp, size_t max_chars,
-                                          char **endp, unsigned int base)
+static noinline unsigned long long simple_strntoull(const char *startp, size_t max_chars, char **endp, unsigned int base)
 {
        const char *cp;
        unsigned long long result = 0ULL;
@@ -408,8 +407,9 @@ int num_to_str(char *buf, int size, unsigned long long num, unsigned int width)
 #define SMALL  32              /* use lowercase in hex (must be 32 == 0x20) */
 #define SPECIAL        64              /* prefix hex with "0x", octal with "0" */
 
+static_assert(SIGN == 1);
 static_assert(ZEROPAD == ('0' - ' '));
-static_assert(SMALL == ' ');
+static_assert(SMALL == ('a' ^ 'A'));
 
 enum format_type {
        FORMAT_TYPE_NONE, /* Just a string part */
@@ -2023,6 +2023,11 @@ char *format_page_flags(char *buf, char *end, unsigned long flags)
        bool append = false;
        int i;
 
+       buf = number(buf, end, flags, default_flag_spec);
+       if (buf < end)
+               *buf = '(';
+       buf++;
+
        /* Page flags from the main area. */
        if (main_flags) {
                buf = format_flags(buf, end, main_flags, pageflag_names);
@@ -2051,6 +2056,9 @@ char *format_page_flags(char *buf, char *end, unsigned long flags)
 
                append = true;
        }
+       if (buf < end)
+               *buf = ')';
+       buf++;
 
        return buf;
 }