Skip to content

Commit

Permalink
kernel/debug/debug_core.c: Logging clean-up
Browse files Browse the repository at this point in the history
-Convert printk( to pr_foo()
-Add pr_fmt
-Coalesce formats

Cc: Jason Wessel <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Joe Perches <[email protected]>
Signed-off-by: Fabian Frederick <[email protected]>
Signed-off-by: Jason Wessel <[email protected]>
  • Loading branch information
Fabian Frederick authored and jwessel committed Nov 11, 2014
1 parent a1465d2 commit 0f16996
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions kernel/debug/debug_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
* version 2. This program is licensed "as is" without any warranty of any
* kind, whether express or implied.
*/

#define pr_fmt(fmt) "KGDB: " fmt

#include <linux/pid_namespace.h>
#include <linux/clocksource.h>
#include <linux/serial_core.h>
Expand Down Expand Up @@ -196,8 +199,8 @@ int __weak kgdb_validate_break_address(unsigned long addr)
return err;
err = kgdb_arch_remove_breakpoint(&tmp);
if (err)
printk(KERN_ERR "KGDB: Critical breakpoint error, kernel "
"memory destroyed at: %lx", addr);
pr_err("Critical breakpoint error, kernel memory destroyed at: %lx\n",
addr);
return err;
}

Expand Down Expand Up @@ -256,8 +259,8 @@ int dbg_activate_sw_breakpoints(void)
error = kgdb_arch_set_breakpoint(&kgdb_break[i]);
if (error) {
ret = error;
printk(KERN_INFO "KGDB: BP install failed: %lx",
kgdb_break[i].bpt_addr);
pr_info("BP install failed: %lx\n",
kgdb_break[i].bpt_addr);
continue;
}

Expand Down Expand Up @@ -319,8 +322,8 @@ int dbg_deactivate_sw_breakpoints(void)
continue;
error = kgdb_arch_remove_breakpoint(&kgdb_break[i]);
if (error) {
printk(KERN_INFO "KGDB: BP remove failed: %lx\n",
kgdb_break[i].bpt_addr);
pr_info("BP remove failed: %lx\n",
kgdb_break[i].bpt_addr);
ret = error;
}

Expand Down Expand Up @@ -367,7 +370,7 @@ int dbg_remove_all_break(void)
goto setundefined;
error = kgdb_arch_remove_breakpoint(&kgdb_break[i]);
if (error)
printk(KERN_ERR "KGDB: breakpoint remove failed: %lx\n",
pr_err("breakpoint remove failed: %lx\n",
kgdb_break[i].bpt_addr);
setundefined:
kgdb_break[i].state = BP_UNDEFINED;
Expand Down Expand Up @@ -400,9 +403,9 @@ static int kgdb_io_ready(int print_wait)
if (print_wait) {
#ifdef CONFIG_KGDB_KDB
if (!dbg_kdb_mode)
printk(KERN_CRIT "KGDB: waiting... or $3#33 for KDB\n");
pr_crit("waiting... or $3#33 for KDB\n");
#else
printk(KERN_CRIT "KGDB: Waiting for remote debugger\n");
pr_crit("Waiting for remote debugger\n");
#endif
}
return 1;
Expand Down Expand Up @@ -430,8 +433,7 @@ static int kgdb_reenter_check(struct kgdb_state *ks)
exception_level = 0;
kgdb_skipexception(ks->ex_vector, ks->linux_regs);
dbg_activate_sw_breakpoints();
printk(KERN_CRIT "KGDB: re-enter error: breakpoint removed %lx\n",
addr);
pr_crit("re-enter error: breakpoint removed %lx\n", addr);
WARN_ON_ONCE(1);

return 1;
Expand All @@ -444,7 +446,7 @@ static int kgdb_reenter_check(struct kgdb_state *ks)
panic("Recursive entry to debugger");
}

printk(KERN_CRIT "KGDB: re-enter exception: ALL breakpoints killed\n");
pr_crit("re-enter exception: ALL breakpoints killed\n");
#ifdef CONFIG_KGDB_KDB
/* Allow kdb to debug itself one level */
return 0;
Expand Down Expand Up @@ -800,15 +802,15 @@ static struct console kgdbcons = {
static void sysrq_handle_dbg(int key)
{
if (!dbg_io_ops) {
printk(KERN_CRIT "ERROR: No KGDB I/O module available\n");
pr_crit("ERROR: No KGDB I/O module available\n");
return;
}
if (!kgdb_connected) {
#ifdef CONFIG_KGDB_KDB
if (!dbg_kdb_mode)
printk(KERN_CRIT "KGDB or $3#33 for KDB\n");
pr_crit("KGDB or $3#33 for KDB\n");
#else
printk(KERN_CRIT "Entering KGDB\n");
pr_crit("Entering KGDB\n");
#endif
}

Expand Down Expand Up @@ -950,7 +952,7 @@ static void kgdb_initial_breakpoint(void)
{
kgdb_break_asap = 0;

printk(KERN_CRIT "kgdb: Waiting for connection from remote gdb...\n");
pr_crit("Waiting for connection from remote gdb...\n");
kgdb_breakpoint();
}

Expand All @@ -969,8 +971,7 @@ int kgdb_register_io_module(struct kgdb_io *new_dbg_io_ops)
if (dbg_io_ops) {
spin_unlock(&kgdb_registration_lock);

printk(KERN_ERR "kgdb: Another I/O driver is already "
"registered with KGDB.\n");
pr_err("Another I/O driver is already registered with KGDB\n");
return -EBUSY;
}

Expand All @@ -986,8 +987,7 @@ int kgdb_register_io_module(struct kgdb_io *new_dbg_io_ops)

spin_unlock(&kgdb_registration_lock);

printk(KERN_INFO "kgdb: Registered I/O driver %s.\n",
new_dbg_io_ops->name);
pr_info("Registered I/O driver %s\n", new_dbg_io_ops->name);

/* Arm KGDB now. */
kgdb_register_callbacks();
Expand Down Expand Up @@ -1022,8 +1022,7 @@ void kgdb_unregister_io_module(struct kgdb_io *old_dbg_io_ops)

spin_unlock(&kgdb_registration_lock);

printk(KERN_INFO
"kgdb: Unregistered I/O driver %s, debugger disabled.\n",
pr_info("Unregistered I/O driver %s, debugger disabled\n",
old_dbg_io_ops->name);
}
EXPORT_SYMBOL_GPL(kgdb_unregister_io_module);
Expand Down

0 comments on commit 0f16996

Please sign in to comment.