diff options
author | Peter Zijlstra <peterz@infradead.org> | 2012-03-15 07:35:37 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2012-03-15 08:38:54 -0400 |
commit | 600e145882802d6ccbfe2c4aea243d97caeb91a9 (patch) | |
tree | 0ad47fe66dfe2ea41a75c493e877483049dd446b /kernel/printk.c | |
parent | 9993bc635d01a6ee7f6b833b4ee65ce7c06350b1 (diff) |
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.c | 40 |
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) | |||
1222 | static DEFINE_PER_CPU(int, printk_pending); | 1222 | static DEFINE_PER_CPU(int, printk_pending); |
1223 | static DEFINE_PER_CPU(char [PRINTK_BUF_SIZE], printk_sched_buf); | 1223 | static DEFINE_PER_CPU(char [PRINTK_BUF_SIZE], printk_sched_buf); |
1224 | 1224 | ||
1225 | int printk_sched(const char *fmt, ...) | ||
1226 | { | ||
1227 | unsigned long flags; | ||
1228 | va_list args; | ||
1229 | char *buf; | ||
1230 | int r; | ||
1231 | |||
1232 | local_irq_save(flags); | ||
1233 | buf = __get_cpu_var(printk_sched_buf); | ||
1234 | |||
1235 | va_start(args, fmt); | ||
1236 | r = vsnprintf(buf, PRINTK_BUF_SIZE, fmt, args); | ||
1237 | va_end(args); | ||
1238 | |||
1239 | __this_cpu_or(printk_pending, PRINTK_PENDING_SCHED); | ||
1240 | local_irq_restore(flags); | ||
1241 | |||
1242 | return r; | ||
1243 | } | ||
1244 | |||
1245 | void printk_tick(void) | 1225 | void printk_tick(void) |
1246 | { | 1226 | { |
1247 | if (__this_cpu_read(printk_pending)) { | 1227 | if (__this_cpu_read(printk_pending)) { |
@@ -1658,6 +1638,26 @@ late_initcall(printk_late_init); | |||
1658 | 1638 | ||
1659 | #if defined CONFIG_PRINTK | 1639 | #if defined CONFIG_PRINTK |
1660 | 1640 | ||
1641 | int printk_sched(const char *fmt, ...) | ||
1642 | { | ||
1643 | unsigned long flags; | ||
1644 | va_list args; | ||
1645 | char *buf; | ||
1646 | int r; | ||
1647 | |||
1648 | local_irq_save(flags); | ||
1649 | buf = __get_cpu_var(printk_sched_buf); | ||
1650 | |||
1651 | va_start(args, fmt); | ||
1652 | r = vsnprintf(buf, PRINTK_BUF_SIZE, fmt, args); | ||
1653 | va_end(args); | ||
1654 | |||
1655 | __this_cpu_or(printk_pending, PRINTK_PENDING_SCHED); | ||
1656 | local_irq_restore(flags); | ||
1657 | |||
1658 | return r; | ||
1659 | } | ||
1660 | |||
1661 | /* | 1661 | /* |
1662 | * printk rate limiting, lifted from the networking subsystem. | 1662 | * printk rate limiting, lifted from the networking subsystem. |
1663 | * | 1663 | * |