diff options
author | Kay Sievers <kay@vrfy.org> | 2012-05-08 19:37:51 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-05-09 18:51:09 -0400 |
commit | 7f3a781d6fd81e397c3928c9af33f1fc63232db6 (patch) | |
tree | 326e060d609a4c7e2775b2af7e82bfa2215a35a9 | |
parent | 6a7e2618b3dbfbf1e8ab2b4be102b2944738fb68 (diff) |
printk - fix compilation for CONFIG_PRINTK=n
Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Kay Sievers <kay@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/char/mem.c | 2 | ||||
-rw-r--r-- | kernel/printk.c | 41 |
2 files changed, 24 insertions, 19 deletions
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 0e7fbfcbd6e6..67c3371723cc 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -825,7 +825,9 @@ static const struct memdev { | |||
825 | [7] = { "full", 0666, &full_fops, NULL }, | 825 | [7] = { "full", 0666, &full_fops, NULL }, |
826 | [8] = { "random", 0666, &random_fops, NULL }, | 826 | [8] = { "random", 0666, &random_fops, NULL }, |
827 | [9] = { "urandom", 0666, &urandom_fops, NULL }, | 827 | [9] = { "urandom", 0666, &urandom_fops, NULL }, |
828 | #ifdef CONFIG_PRINTK | ||
828 | [11] = { "kmsg", 0644, &kmsg_fops, NULL }, | 829 | [11] = { "kmsg", 0644, &kmsg_fops, NULL }, |
830 | #endif | ||
829 | #ifdef CONFIG_CRASH_DUMP | 831 | #ifdef CONFIG_CRASH_DUMP |
830 | [12] = { "oldmem", 0, &oldmem_fops, NULL }, | 832 | [12] = { "oldmem", 0, &oldmem_fops, NULL }, |
831 | #endif | 833 | #endif |
diff --git a/kernel/printk.c b/kernel/printk.c index 96d4cc892255..7b432951f91e 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -126,7 +126,6 @@ EXPORT_SYMBOL(console_set_on_cmdline); | |||
126 | /* Flag: console code may call schedule() */ | 126 | /* Flag: console code may call schedule() */ |
127 | static int console_may_schedule; | 127 | static int console_may_schedule; |
128 | 128 | ||
129 | #ifdef CONFIG_PRINTK | ||
130 | /* | 129 | /* |
131 | * The printk log buffer consists of a chain of concatenated variable | 130 | * The printk log buffer consists of a chain of concatenated variable |
132 | * length records. Every record starts with a record header, containing | 131 | * length records. Every record starts with a record header, containing |
@@ -208,16 +207,9 @@ struct log { | |||
208 | */ | 207 | */ |
209 | static DEFINE_RAW_SPINLOCK(logbuf_lock); | 208 | static DEFINE_RAW_SPINLOCK(logbuf_lock); |
210 | 209 | ||
211 | /* cpu currently holding logbuf_lock */ | 210 | /* the next printk record to read by syslog(READ) or /proc/kmsg */ |
212 | static volatile unsigned int logbuf_cpu = UINT_MAX; | 211 | static u64 syslog_seq; |
213 | 212 | static u32 syslog_idx; | |
214 | #define LOG_LINE_MAX 1024 | ||
215 | |||
216 | /* record buffer */ | ||
217 | #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) | ||
218 | static char __log_buf[__LOG_BUF_LEN]; | ||
219 | static char *log_buf = __log_buf; | ||
220 | static u32 log_buf_len = __LOG_BUF_LEN; | ||
221 | 213 | ||
222 | /* index and sequence number of the first record stored in the buffer */ | 214 | /* index and sequence number of the first record stored in the buffer */ |
223 | static u64 log_first_seq; | 215 | static u64 log_first_seq; |
@@ -225,15 +217,23 @@ static u32 log_first_idx; | |||
225 | 217 | ||
226 | /* index and sequence number of the next record to store in the buffer */ | 218 | /* index and sequence number of the next record to store in the buffer */ |
227 | static u64 log_next_seq; | 219 | static u64 log_next_seq; |
220 | #ifdef CONFIG_PRINTK | ||
228 | static u32 log_next_idx; | 221 | static u32 log_next_idx; |
229 | 222 | ||
230 | /* the next printk record to read after the last 'clear' command */ | 223 | /* the next printk record to read after the last 'clear' command */ |
231 | static u64 clear_seq; | 224 | static u64 clear_seq; |
232 | static u32 clear_idx; | 225 | static u32 clear_idx; |
233 | 226 | ||
234 | /* the next printk record to read by syslog(READ) or /proc/kmsg */ | 227 | #define LOG_LINE_MAX 1024 |
235 | static u64 syslog_seq; | 228 | |
236 | static u32 syslog_idx; | 229 | /* record buffer */ |
230 | #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) | ||
231 | static char __log_buf[__LOG_BUF_LEN]; | ||
232 | static char *log_buf = __log_buf; | ||
233 | static u32 log_buf_len = __LOG_BUF_LEN; | ||
234 | |||
235 | /* cpu currently holding logbuf_lock */ | ||
236 | static volatile unsigned int logbuf_cpu = UINT_MAX; | ||
237 | 237 | ||
238 | /* human readable text of the record */ | 238 | /* human readable text of the record */ |
239 | static char *log_text(const struct log *msg) | 239 | static char *log_text(const struct log *msg) |
@@ -1425,13 +1425,16 @@ asmlinkage int printk(const char *fmt, ...) | |||
1425 | return r; | 1425 | return r; |
1426 | } | 1426 | } |
1427 | EXPORT_SYMBOL(printk); | 1427 | EXPORT_SYMBOL(printk); |
1428 | |||
1428 | #else | 1429 | #else |
1429 | 1430 | ||
1430 | static void call_console_drivers(int level, const char *text, size_t len) | 1431 | #define LOG_LINE_MAX 0 |
1431 | { | 1432 | static struct log *log_from_idx(u32 idx) { return NULL; } |
1432 | } | 1433 | static u32 log_next(u32 idx) { return 0; } |
1434 | static char *log_text(const struct log *msg) { return NULL; } | ||
1435 | static void call_console_drivers(int level, const char *text, size_t len) {} | ||
1433 | 1436 | ||
1434 | #endif | 1437 | #endif /* CONFIG_PRINTK */ |
1435 | 1438 | ||
1436 | static int __add_preferred_console(char *name, int idx, char *options, | 1439 | static int __add_preferred_console(char *name, int idx, char *options, |
1437 | char *brl_options) | 1440 | char *brl_options) |
@@ -1715,7 +1718,7 @@ static u32 console_idx; | |||
1715 | * by printk(). If this is the case, console_unlock(); emits | 1718 | * by printk(). If this is the case, console_unlock(); emits |
1716 | * the output prior to releasing the lock. | 1719 | * the output prior to releasing the lock. |
1717 | * | 1720 | * |
1718 | * If there is output waiting, we wake it /dev/kmsg and syslog() users. | 1721 | * If there is output waiting, we wake /dev/kmsg and syslog() users. |
1719 | * | 1722 | * |
1720 | * console_unlock(); may be called from any context. | 1723 | * console_unlock(); may be called from any context. |
1721 | */ | 1724 | */ |