aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2012-05-08 19:37:51 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-05-09 18:51:09 -0400
commit7f3a781d6fd81e397c3928c9af33f1fc63232db6 (patch)
tree326e060d609a4c7e2775b2af7e82bfa2215a35a9
parent6a7e2618b3dbfbf1e8ab2b4be102b2944738fb68 (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.c2
-rw-r--r--kernel/printk.c41
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() */
127static int console_may_schedule; 127static 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 */
209static DEFINE_RAW_SPINLOCK(logbuf_lock); 208static 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 */
212static volatile unsigned int logbuf_cpu = UINT_MAX; 211static u64 syslog_seq;
213 212static u32 syslog_idx;
214#define LOG_LINE_MAX 1024
215
216/* record buffer */
217#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
218static char __log_buf[__LOG_BUF_LEN];
219static char *log_buf = __log_buf;
220static 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 */
223static u64 log_first_seq; 215static 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 */
227static u64 log_next_seq; 219static u64 log_next_seq;
220#ifdef CONFIG_PRINTK
228static u32 log_next_idx; 221static 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 */
231static u64 clear_seq; 224static u64 clear_seq;
232static u32 clear_idx; 225static u32 clear_idx;
233 226
234/* the next printk record to read by syslog(READ) or /proc/kmsg */ 227#define LOG_LINE_MAX 1024
235static u64 syslog_seq; 228
236static u32 syslog_idx; 229/* record buffer */
230#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
231static char __log_buf[__LOG_BUF_LEN];
232static char *log_buf = __log_buf;
233static u32 log_buf_len = __LOG_BUF_LEN;
234
235/* cpu currently holding logbuf_lock */
236static volatile unsigned int logbuf_cpu = UINT_MAX;
237 237
238/* human readable text of the record */ 238/* human readable text of the record */
239static char *log_text(const struct log *msg) 239static 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}
1427EXPORT_SYMBOL(printk); 1427EXPORT_SYMBOL(printk);
1428
1428#else 1429#else
1429 1430
1430static void call_console_drivers(int level, const char *text, size_t len) 1431#define LOG_LINE_MAX 0
1431{ 1432static struct log *log_from_idx(u32 idx) { return NULL; }
1432} 1433static u32 log_next(u32 idx) { return 0; }
1434static char *log_text(const struct log *msg) { return NULL; }
1435static void call_console_drivers(int level, const char *text, size_t len) {}
1433 1436
1434#endif 1437#endif /* CONFIG_PRINTK */
1435 1438
1436static int __add_preferred_console(char *name, int idx, char *options, 1439static 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 */