]> www.infradead.org Git - users/willy/linux.git/commitdiff
printf: Convert mac_address_string to printf_state
authorMatthew Wilcox <willy@infradead.org>
Thu, 20 Dec 2018 04:00:33 +0000 (23:00 -0500)
committerMatthew Wilcox <willy@infradead.org>
Thu, 20 Dec 2018 04:01:22 +0000 (23:01 -0500)
Signed-off-by: Matthew Wilcox <willy@infradead.org>
lib/vsprintf.c

index 700d48d5acf6384dc49c903cec829c79c3ed41b2..6103e7a89857cd06109b991fb17179232022772e 100644 (file)
@@ -1048,8 +1048,7 @@ char *bitmap_list_string(struct printf_state *ps, unsigned long *bitmap)
 }
 
 static noinline_for_stack
-char *mac_address_string(char *buf, char *end, u8 *addr,
-                        struct printf_spec spec, const char *fmt)
+char *mac_address_string(struct printf_state *ps, u8 *addr)
 {
        char mac_addr[sizeof("xx:xx:xx:xx:xx:xx")];
        char *p = mac_addr;
@@ -1057,7 +1056,7 @@ char *mac_address_string(char *buf, char *end, u8 *addr,
        char separator;
        bool reversed = false;
 
-       switch (fmt[1]) {
+       switch (ps->fmt[1]) {
        case 'F':
                separator = '-';
                break;
@@ -1077,12 +1076,13 @@ char *mac_address_string(char *buf, char *end, u8 *addr,
                else
                        p = hex_byte_pack(p, addr[i]);
 
-               if (fmt[0] == 'M' && i != 5)
+               if (ps->fmt[0] == 'M' && i != 5)
                        *p++ = separator;
        }
        *p = '\0';
 
-       return string(buf, end, mac_addr, spec);
+       printf_string(ps, mac_addr);
+       return ps->buf;
 }
 
 static noinline_for_stack
@@ -1899,7 +1899,7 @@ char *pointer(struct printf_state *ps, void *ptr)
        case 'm':                       /* Contiguous: 000102030405 */
                                        /* [mM]F (FDDI) */
                                        /* [mM]R (Reverse order; Bluetooth) */
-               return mac_address_string(buf, end, ptr, spec, fmt);
+               return mac_address_string(ps, ptr);
        case 'I':                       /* Formatted IP supported
                                         * 4:   1.2.3.4
                                         * 6:   0001:0203:...:0708