diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2014-11-21 09:16:58 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-11-21 11:19:15 -0500 |
commit | 04b74b27c2941e5d62120f6fee3a0a9388a30613 (patch) | |
tree | 05a24b1a4768b12f6656a6121d1281ed77426116 | |
parent | a9edc88093287183ac934be44f295f183b2c62dd (diff) |
printk/percpu: Define printk_func when printk is not defined
To avoid include hell, the per_cpu variable printk_func was declared
in percpu.h. But it is only defined if printk is defined.
As users of printk may also use the printk_func variable, it needs to
be defined even if CONFIG_PRINTK is not.
Also add a printk.h include in percpu.h just to be safe.
Link: http://lkml.kernel.org/r/20141121183215.01ba539c@canb.auug.org.au
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | include/linux/percpu.h | 1 | ||||
-rw-r--r-- | include/linux/printk.h | 4 | ||||
-rw-r--r-- | kernel/printk/printk.c | 3 |
3 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index ba2e85a0ff5b..caebf2a758dc 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/preempt.h> | 5 | #include <linux/preempt.h> |
6 | #include <linux/smp.h> | 6 | #include <linux/smp.h> |
7 | #include <linux/cpumask.h> | 7 | #include <linux/cpumask.h> |
8 | #include <linux/printk.h> | ||
8 | #include <linux/pfn.h> | 9 | #include <linux/pfn.h> |
9 | #include <linux/init.h> | 10 | #include <linux/init.h> |
10 | 11 | ||
diff --git a/include/linux/printk.h b/include/linux/printk.h index 3bbd979d32fb..c69be9ee8f48 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h | |||
@@ -124,6 +124,8 @@ static inline __printf(1, 2) __cold | |||
124 | void early_printk(const char *s, ...) { } | 124 | void early_printk(const char *s, ...) { } |
125 | #endif | 125 | #endif |
126 | 126 | ||
127 | typedef int(*printk_func_t)(const char *fmt, va_list args); | ||
128 | |||
127 | #ifdef CONFIG_PRINTK | 129 | #ifdef CONFIG_PRINTK |
128 | asmlinkage __printf(5, 0) | 130 | asmlinkage __printf(5, 0) |
129 | int vprintk_emit(int facility, int level, | 131 | int vprintk_emit(int facility, int level, |
@@ -162,8 +164,6 @@ extern int kptr_restrict; | |||
162 | 164 | ||
163 | extern void wake_up_klogd(void); | 165 | extern void wake_up_klogd(void); |
164 | 166 | ||
165 | typedef int(*printk_func_t)(const char *fmt, va_list args); | ||
166 | |||
167 | void log_buf_kexec_setup(void); | 167 | void log_buf_kexec_setup(void); |
168 | void __init setup_log_buf(int early); | 168 | void __init setup_log_buf(int early); |
169 | void dump_stack_set_arch_desc(const char *fmt, ...); | 169 | void dump_stack_set_arch_desc(const char *fmt, ...); |
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index f7b723f98cb9..5af2b8bc88f0 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
@@ -1896,6 +1896,9 @@ static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev, | |||
1896 | bool syslog, char *buf, size_t size) { return 0; } | 1896 | bool syslog, char *buf, size_t size) { return 0; } |
1897 | static size_t cont_print_text(char *text, size_t size) { return 0; } | 1897 | static size_t cont_print_text(char *text, size_t size) { return 0; } |
1898 | 1898 | ||
1899 | /* Still needs to be defined for users */ | ||
1900 | DEFINE_PER_CPU(printk_func_t, printk_func); | ||
1901 | |||
1899 | #endif /* CONFIG_PRINTK */ | 1902 | #endif /* CONFIG_PRINTK */ |
1900 | 1903 | ||
1901 | #ifdef CONFIG_EARLY_PRINTK | 1904 | #ifdef CONFIG_EARLY_PRINTK |