summaryrefslogtreecommitdiff
path: root/kernel/printk.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2012-03-15 12:35:37 +0100
committerIngo Molnar <mingo@elte.hu>2012-03-15 13:38:54 +0100
commit600e145882802d6ccbfe2c4aea243d97caeb91a9 (patch)
tree0ad47fe66dfe2ea41a75c493e877483049dd446b /kernel/printk.c
parent9993bc635d01a6ee7f6b833b4ee65ce7c06350b1 (diff)
downloadlwn-600e145882802d6ccbfe2c4aea243d97caeb91a9.tar.gz
lwn-600e145882802d6ccbfe2c4aea243d97caeb91a9.zip
printk: Make it compile with !CONFIG_PRINTK
Commit 3ccf3e830615 ("printk/sched: Introduce special printk_sched() for those awkward moments") overlooked an #ifdef, so move code around to respect these directives. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Randy Dunlap <rdunlap@xenotime.net> Link: http://lkml.kernel.org/r/1331811337.18960.179.camel@twins Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/printk.c')
-rw-r--r--kernel/printk.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index 49a2ae4a8dc7..b64ce71cb2e5 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1222,26 +1222,6 @@ int is_console_locked(void)
static DEFINE_PER_CPU(int, printk_pending);
static DEFINE_PER_CPU(char [PRINTK_BUF_SIZE], printk_sched_buf);
-int printk_sched(const char *fmt, ...)
-{
- unsigned long flags;
- va_list args;
- char *buf;
- int r;
-
- local_irq_save(flags);
- buf = __get_cpu_var(printk_sched_buf);
-
- va_start(args, fmt);
- r = vsnprintf(buf, PRINTK_BUF_SIZE, fmt, args);
- va_end(args);
-
- __this_cpu_or(printk_pending, PRINTK_PENDING_SCHED);
- local_irq_restore(flags);
-
- return r;
-}
-
void printk_tick(void)
{
if (__this_cpu_read(printk_pending)) {
@@ -1658,6 +1638,26 @@ late_initcall(printk_late_init);
#if defined CONFIG_PRINTK
+int printk_sched(const char *fmt, ...)
+{
+ unsigned long flags;
+ va_list args;
+ char *buf;
+ int r;
+
+ local_irq_save(flags);
+ buf = __get_cpu_var(printk_sched_buf);
+
+ va_start(args, fmt);
+ r = vsnprintf(buf, PRINTK_BUF_SIZE, fmt, args);
+ va_end(args);
+
+ __this_cpu_or(printk_pending, PRINTK_PENDING_SCHED);
+ local_irq_restore(flags);
+
+ return r;
+}
+
/*
* printk rate limiting, lifted from the networking subsystem.
*