diff options
author | Joe Perches <joe@perches.com> | 2014-12-10 18:45:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 20:41:10 -0500 |
commit | 1dc6244bd6d4f62239487fb0befc41c63e117290 (patch) | |
tree | e4297d59fc7ee4130059ad082ac7cf206195d408 | |
parent | 9e3961a0979817c612b10b2da4f3045ec9faa779 (diff) |
printk: remove used-once early_vprintk
Eliminate the unlikely possibility of message interleaving for
early_printk/early_vprintk use.
early_vprintk can be done via the %pV extension so remove this
unnecessary function and change early_printk to have the equivalent
vprintk code.
All uses of early_printk already end with a newline so also remove the
unnecessary newline from the early_printk function.
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/tile/kernel/early_printk.c | 19 | ||||
-rw-r--r-- | include/linux/printk.h | 1 | ||||
-rw-r--r-- | kernel/printk/printk.c | 19 |
3 files changed, 21 insertions, 18 deletions
diff --git a/arch/tile/kernel/early_printk.c b/arch/tile/kernel/early_printk.c index b608e00e7f6d..aefb2c086726 100644 --- a/arch/tile/kernel/early_printk.c +++ b/arch/tile/kernel/early_printk.c | |||
@@ -43,13 +43,20 @@ static struct console early_hv_console = { | |||
43 | 43 | ||
44 | void early_panic(const char *fmt, ...) | 44 | void early_panic(const char *fmt, ...) |
45 | { | 45 | { |
46 | va_list ap; | 46 | struct va_format vaf; |
47 | va_list args; | ||
48 | |||
47 | arch_local_irq_disable_all(); | 49 | arch_local_irq_disable_all(); |
48 | va_start(ap, fmt); | 50 | |
49 | early_printk("Kernel panic - not syncing: "); | 51 | va_start(args, fmt); |
50 | early_vprintk(fmt, ap); | 52 | |
51 | early_printk("\n"); | 53 | vaf.fmt = fmt; |
52 | va_end(ap); | 54 | vaf.va = &args; |
55 | |||
56 | early_printk("Kernel panic - not syncing: %pV", &vaf); | ||
57 | |||
58 | va_end(args); | ||
59 | |||
53 | dump_stack(); | 60 | dump_stack(); |
54 | hv_halt(); | 61 | hv_halt(); |
55 | } | 62 | } |
diff --git a/include/linux/printk.h b/include/linux/printk.h index d78125f73ac4..3dd489f2dedc 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h | |||
@@ -118,7 +118,6 @@ int no_printk(const char *fmt, ...) | |||
118 | #ifdef CONFIG_EARLY_PRINTK | 118 | #ifdef CONFIG_EARLY_PRINTK |
119 | extern asmlinkage __printf(1, 2) | 119 | extern asmlinkage __printf(1, 2) |
120 | void early_printk(const char *fmt, ...); | 120 | void early_printk(const char *fmt, ...); |
121 | void early_vprintk(const char *fmt, va_list ap); | ||
122 | #else | 121 | #else |
123 | static inline __printf(1, 2) __cold | 122 | static inline __printf(1, 2) __cold |
124 | void early_printk(const char *s, ...) { } | 123 | void early_printk(const char *s, ...) { } |
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index ced2b84b1cb7..4815c98ae175 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
@@ -1881,23 +1881,20 @@ static size_t cont_print_text(char *text, size_t size) { return 0; } | |||
1881 | #ifdef CONFIG_EARLY_PRINTK | 1881 | #ifdef CONFIG_EARLY_PRINTK |
1882 | struct console *early_console; | 1882 | struct console *early_console; |
1883 | 1883 | ||
1884 | void early_vprintk(const char *fmt, va_list ap) | ||
1885 | { | ||
1886 | if (early_console) { | ||
1887 | char buf[512]; | ||
1888 | int n = vscnprintf(buf, sizeof(buf), fmt, ap); | ||
1889 | |||
1890 | early_console->write(early_console, buf, n); | ||
1891 | } | ||
1892 | } | ||
1893 | |||
1894 | asmlinkage __visible void early_printk(const char *fmt, ...) | 1884 | asmlinkage __visible void early_printk(const char *fmt, ...) |
1895 | { | 1885 | { |
1896 | va_list ap; | 1886 | va_list ap; |
1887 | char buf[512]; | ||
1888 | int n; | ||
1889 | |||
1890 | if (!early_console) | ||
1891 | return; | ||
1897 | 1892 | ||
1898 | va_start(ap, fmt); | 1893 | va_start(ap, fmt); |
1899 | early_vprintk(fmt, ap); | 1894 | n = vscnprintf(buf, sizeof(buf), fmt, ap); |
1900 | va_end(ap); | 1895 | va_end(ap); |
1896 | |||
1897 | early_console->write(early_console, buf, n); | ||
1901 | } | 1898 | } |
1902 | #endif | 1899 | #endif |
1903 | 1900 | ||