1 From ecf242f713e3f6d1431a98869a14701cdadb70d3 Mon Sep 17 00:00:00 2001
2 From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
3 Date: Thu, 4 Feb 2016 18:56:10 +0100
4 Subject: [PATCH 281/366] printk: fix a build on powerpc
6 As pwe kbuild test robot:
7 arch/powerpc/kernel/built-in.o: In function `register_early_udbg_console':
8 >> (.init.text+0x1266): undefined reference to `early_console'
9 arch/powerpc/kernel/built-in.o: In function `register_early_udbg_console':
10 (.init.text+0x126a): undefined reference to `early_console'
11 arch/powerpc/kernel/built-in.o: In function `register_early_udbg_console':
12 (.init.text+0x12d2): undefined reference to `early_console'
14 Reported-by: kbuild test robot <fengguang.wu@intel.com>
15 Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
17 kernel/printk/printk.c | 115 +++++++++++++++++++++++++------------------------
18 1 file changed, 59 insertions(+), 56 deletions(-)
20 diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
21 index 84400c4..cd377c4 100644
22 --- a/kernel/printk/printk.c
23 +++ b/kernel/printk/printk.c
24 @@ -245,6 +245,65 @@ struct printk_log {
26 static DEFINE_RAW_SPINLOCK(logbuf_lock);
28 +#ifdef CONFIG_EARLY_PRINTK
29 +struct console *early_console;
31 +static void early_vprintk(const char *fmt, va_list ap)
33 + if (early_console) {
35 + int n = vscnprintf(buf, sizeof(buf), fmt, ap);
37 + early_console->write(early_console, buf, n);
41 +asmlinkage void early_printk(const char *fmt, ...)
46 + early_vprintk(fmt, ap);
51 + * This is independent of any log levels - a global
52 + * kill switch that turns off all of printk.
54 + * Used by the NMI watchdog if early-printk is enabled.
56 +static bool __read_mostly printk_killswitch;
58 +static int __init force_early_printk_setup(char *str)
60 + printk_killswitch = true;
63 +early_param("force_early_printk", force_early_printk_setup);
65 +void printk_kill(void)
67 + printk_killswitch = true;
71 +static int forced_early_printk(const char *fmt, va_list ap)
73 + if (!printk_killswitch)
75 + early_vprintk(fmt, ap);
81 +static inline int forced_early_printk(const char *fmt, va_list ap)
88 DECLARE_WAIT_QUEUE_HEAD(log_wait);
89 /* the next printk record to read by syslog(READ) or /proc/kmsg */
90 @@ -1731,62 +1790,6 @@ static size_t cont_print_text(char *text, size_t size)
94 -#ifdef CONFIG_EARLY_PRINTK
95 -struct console *early_console;
97 -static void early_vprintk(const char *fmt, va_list ap)
99 - if (early_console) {
101 - int n = vscnprintf(buf, sizeof(buf), fmt, ap);
103 - early_console->write(early_console, buf, n);
107 -asmlinkage void early_printk(const char *fmt, ...)
112 - early_vprintk(fmt, ap);
117 - * This is independent of any log levels - a global
118 - * kill switch that turns off all of printk.
120 - * Used by the NMI watchdog if early-printk is enabled.
122 -static bool __read_mostly printk_killswitch;
124 -static int __init force_early_printk_setup(char *str)
126 - printk_killswitch = true;
129 -early_param("force_early_printk", force_early_printk_setup);
131 -void printk_kill(void)
133 - printk_killswitch = true;
136 -static int forced_early_printk(const char *fmt, va_list ap)
138 - if (!printk_killswitch)
140 - early_vprintk(fmt, ap);
144 -static inline int forced_early_printk(const char *fmt, va_list ap)
150 asmlinkage int vprintk_emit(int facility, int level,
151 const char *dict, size_t dictlen,
152 const char *fmt, va_list args)