diff options
-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 | * |