]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
device: Make dev_WARN/dev_WARN_ONCE print device as well as driver name
authorBjorn Helgaas <bhelgaas@google.com>
Thu, 24 Oct 2013 21:42:33 +0000 (15:42 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Oct 2013 23:06:07 +0000 (16:06 -0700)
dev_WARN() and dev_WARN_ONCE() are annoying because (1) they include
only the driver name, not the device name, and (2) they print a spurious
newline in the middle.  This results in messages like this that are less
useful than they should be:

  [   40.094995] Device pcieport
  disabling already-disabled device

This patch makes them work more like dev_printk().

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/device.h

index 5e44cff5bced00273142f2fc5ed0621dff8acf3a..b025925df7f75a5b86fa894de93e2e83d0bdf571 100644 (file)
@@ -1170,16 +1170,15 @@ do {                                                                    \
 #endif
 
 /*
- * dev_WARN*() acts like dev_printk(), but with the key difference
- * of using a WARN/WARN_ON to get the message out, including the
- * file/line information and a backtrace.
+ * dev_WARN*() acts like dev_printk(), but with the key difference of
+ * using WARN/WARN_ONCE to include file/line information and a backtrace.
  */
 #define dev_WARN(dev, format, arg...) \
-       WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg);
+       WARN(1, "%s %s: " format, dev_driver_string(dev), dev_name(dev), ## arg);
 
 #define dev_WARN_ONCE(dev, condition, format, arg...) \
-       WARN_ONCE(condition, "Device %s\n" format, \
-                       dev_driver_string(dev), ## arg)
+       WARN_ONCE(condition, "%s %s: " format, \
+                       dev_driver_string(dev), dev_name(dev), ## arg)
 
 /* Create alias, so I can be autoloaded. */
 #define MODULE_ALIAS_CHARDEV(major,minor) \