]> www.infradead.org Git - users/willy/linux.git/commitdiff
printf: Convert clock to printf_state
authorMatthew Wilcox <willy@infradead.org>
Wed, 19 Dec 2018 15:30:06 +0000 (10:30 -0500)
committerMatthew Wilcox <willy@infradead.org>
Wed, 19 Dec 2018 15:30:06 +0000 (10:30 -0500)
Signed-off-by: Matthew Wilcox <willy@infradead.org>
lib/vsprintf.c

index 570bfe8dc465179d0a6bc99ef888904562d87235..46dffe1d7108a189d99855b420bd36bab29623e4 100644 (file)
@@ -1555,19 +1555,21 @@ char *address_val(struct printf_state *ps, const void *addr)
 }
 
 static noinline_for_stack
-char *clock(char *buf, char *end, struct clk *clk, struct printf_spec spec,
-           const char *fmt)
+char *clock(struct printf_state *ps, struct clk *clk)
 {
-       if (!IS_ENABLED(CONFIG_HAVE_CLK) || !clk)
-               return string(buf, end, NULL, spec);
+       if (!IS_ENABLED(CONFIG_HAVE_CLK) || !clk) {
+               printf_string(ps, NULL);
+               return ps->buf;
+       }
 
-       switch (fmt[1]) {
+       switch (ps->fmt[1]) {
        case 'n':
        default:
 #ifdef CONFIG_COMMON_CLK
-               return string(buf, end, __clk_get_name(clk), spec);
+               printf_string(ps, __clk_get_name(clk));
+               return ps->buf;
 #else
-               return ptr_to_id(buf, end, clk, spec);
+               return ptr_to_id(ps->buf, ps->end, clk, ps->spec);
 #endif
        }
 }
@@ -1965,7 +1967,7 @@ char *pointer(struct printf_state *ps, void *ptr)
        case 'd':
                return dentry_name(ps, ptr);
        case 'C':
-               return clock(buf, end, ptr, spec, fmt);
+               return clock(ps, ptr);
 #ifdef CONFIG_BLOCK
        case 'g':
                return bdev_name(ps, ptr);