Skip to content

Commit c56ba70

Browse files
Fabian Fredericktorvalds
authored andcommitted
lib/bug.c: convert printk to pr_foo()
- Coalesce formats - "WARNING:" prefix unchanged to keep bug format. - printk(KERN_DEFAULT not converted. - define pr_fmt without prefix to avoid any default prefix update (suggested by Joe Perches). Signed-off-by: Fabian Frederick <fabf@skynet.be> Cc: Jeremy Fitzhardinge <jeremy@goop.org> Cc: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent ce643a3 commit c56ba70

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

‎lib/bug.c‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
3838
Jeremy Fitzhardinge <jeremy@goop.org> 2006
3939
*/
40+
41+
#define pr_fmt(fmt) fmt
42+
4043
#include <linux/list.h>
4144
#include <linux/module.h>
4245
#include <linux/kernel.h>
@@ -153,15 +156,13 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs)
153156

154157
if (warning) {
155158
/* this is a WARN_ON rather than BUG/BUG_ON */
156-
printk(KERN_WARNING "------------[ cut here ]------------\n");
159+
pr_warn("------------[ cut here ]------------\n");
157160

158161
if (file)
159-
printk(KERN_WARNING "WARNING: at %s:%u\n",
160-
file, line);
162+
pr_warn("WARNING: at %s:%u\n", file, line);
161163
else
162-
printk(KERN_WARNING "WARNING: at %p "
163-
"[verbose debug info unavailable]\n",
164-
(void *)bugaddr);
164+
pr_warn("WARNING: at %p [verbose debug info unavailable]\n",
165+
(void *)bugaddr);
165166

166167
print_modules();
167168
show_regs(regs);
@@ -174,12 +175,10 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs)
174175
printk(KERN_DEFAULT "------------[ cut here ]------------\n");
175176

176177
if (file)
177-
printk(KERN_CRIT "kernel BUG at %s:%u!\n",
178-
file, line);
178+
pr_crit("kernel BUG at %s:%u!\n", file, line);
179179
else
180-
printk(KERN_CRIT "Kernel BUG at %p "
181-
"[verbose debug info unavailable]\n",
182-
(void *)bugaddr);
180+
pr_crit("Kernel BUG at %p [verbose debug info unavailable]\n",
181+
(void *)bugaddr);
183182

184183
return BUG_TRAP_TYPE_BUG;
185184
}

0 commit comments

Comments
 (0)