diff options
author | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-11-03 02:01:53 -0700 |
---|---|---|
committer | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-11-05 11:48:36 -0800 |
commit | 0844f3249d38664fcbb015644702c3c82f2b5349 (patch) | |
tree | 9f0eeeb43aa35fcdd7edbf7a981bc0bea79184b5 | |
parent | ed33efebb76eacfdd96aeb5b53b35471190e19c2 (diff) |
ARM: fiq_debugger: Switch from log_buf_copy to kmsg_dump
In newer kernels, after the global printk rework, there is no such thing
as log_buf_copy anymore. Instead, we should use kmsg_dump helpers. They
also provide a proper _nolock variants, so we don't have to play with
oops_in_progress.
The commit fixes the following build error:
arch/arm/common/built-in.o: In function `end_syslog_dump':
fiq_debugger.c:(.text+0x10a4): undefined reference to `log_buf_copy'
arch/arm/common/built-in.o: In function `dump_kernel_log':
fiq_debugger.c:(.text+0x110c): undefined reference to `log_buf_copy'
make: *** [vmlinux] Error 1
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
-rw-r--r-- | arch/arm/common/fiq_debugger.c | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/arch/arm/common/fiq_debugger.c b/arch/arm/common/fiq_debugger.c index c46e331a0ebc..3f25a6a2f547 100644 --- a/arch/arm/common/fiq_debugger.c +++ b/arch/arm/common/fiq_debugger.c @@ -33,6 +33,7 @@ #include <linux/tty.h> #include <linux/tty_flip.h> #include <linux/wakelock.h> +#include <linux/kmsg_dump.h> #include <asm/fiq_debugger.h> #include <asm/fiq_glue.h> @@ -207,31 +208,6 @@ static void debug_prompt(struct fiq_debugger_state *state) debug_puts(state, "debug> "); } -int log_buf_copy(char *dest, int idx, int len); -static void dump_kernel_log(struct fiq_debugger_state *state) -{ - char buf[1024]; - int idx = 0; - int ret; - int saved_oip; - - /* setting oops_in_progress prevents log_buf_copy() - * from trying to take a spinlock which will make it - * very unhappy in some cases... - */ - saved_oip = oops_in_progress; - oops_in_progress = 1; - for (;;) { - ret = log_buf_copy(buf, idx, 1023); - if (ret <= 0) - break; - buf[ret] = 0; - debug_puts(state, buf); - idx += ret; - } - oops_in_progress = saved_oip; -} - static char *mode_name(unsigned cpsr) { switch (cpsr & MODE_MASK) { @@ -503,6 +479,21 @@ static void do_ps(struct fiq_debugger_state *state) read_unlock(&tasklist_lock); } +static void dump_kernel_log(struct fiq_debugger_state *state) +{ +#ifdef CONFIG_PRINTK + char buf[512]; + struct kmsg_dumper dumper = { .active = 1 }; + size_t len; + + kmsg_dump_rewind_nolock(&dumper); + while (kmsg_dump_get_line_nolock(&dumper, 1, buf, sizeof(buf), &len)) + debug_printf(state, "%.*s\n", (int)len - 1, buf); +#else + debug_puts("Unavailable without CONFIG_PRINTK.\n"); +#endif /* CONFIG_PRINTK */ +} + #ifdef CONFIG_FIQ_DEBUGGER_CONSOLE static void begin_syslog_dump(struct fiq_debugger_state *state) { @@ -522,18 +513,7 @@ static void begin_syslog_dump(struct fiq_debugger_state *state) static void end_syslog_dump(struct fiq_debugger_state *state) { - char buf[128]; - int ret; - int idx = 0; - - while (1) { - ret = log_buf_copy(buf, idx, sizeof(buf) - 1); - if (ret <= 0) - break; - buf[ret] = 0; - debug_printf(state, "%s", buf); - idx += ret; - } + dump_kernel_log(state); } #endif |