lkml.org 
[lkml]   [2008]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] usb.h: reduce syslog clutter [v3]
Date
The the err() / info() / warn() macros in usb.h inserted __FILE__ at
the beginning of the message, which expands to the complete pathname
of the source file within the kernel tree, frequently taking up half
of an 80 character screen line before the actual message even begins.
Use the module name instead.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
---

The previous version of this patch was posted and discussed in March
2006, and while displaying module names instead of file pathnames in
messages to users was generally approved of, the patch itself was
rejected on the grounds that these macros should rather be gotten
rid of entirely, and their use replaced by dev_err() / dev_info() /
dev_warn() everywhere.

Two years later, there's not much progress on this front, and on a
typical desktop system, dmesg still shows a substantial number of
full source path names from these macros. I would therefore like to
re-propose this patch as a short-term fix until the bigger goal can
be achieved.

Tested on x86 with modular and non-modular kernel builds.

include/linux/usb.h | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/include/linux/usb.h b/include/linux/usb.h
index 583e048..394cb5f 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1661,13 +1661,12 @@ extern void usb_unregister_notify(struct notifier_block *nb);
#define dbg(format, arg...) do {} while (0)
#endif

-#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , \
- __FILE__ , ## arg)
-#define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , \
- __FILE__ , ## arg)
-#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , \
- __FILE__ , ## arg)
-
+#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
+ format "\n" , ## arg)
+#define info(format, arg...) printk(KERN_INFO KBUILD_MODNAME ": " \
+ format "\n" , ## arg)
+#define warn(format, arg...) printk(KERN_WARNING KBUILD_MODNAME ": " \
+ format "\n" , ## arg)

#endif /* __KERNEL__ */

--
1.5.4.7.gd8534-dirty


\
 
 \ /
  Last update: 2008-03-13 19:55    [W:0.024 / U:3.700 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site