diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2013-10-24 17:42:33 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-29 19:06:07 -0400 |
commit | 3eae13671716492f3bcde270115407185e9c69fd (patch) | |
tree | 80fb3ba611ad5f0b1a53f23e5d36ed3f6f59bcd0 | |
parent | d1c1459e45944e336a968acce1e459c9effcde47 (diff) |
device: Make dev_WARN/dev_WARN_ONCE print device as well as driver name
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>
-rw-r--r-- | include/linux/device.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 5e44cff5bced..b025925df7f7 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -1170,16 +1170,15 @@ do { \ | |||
1170 | #endif | 1170 | #endif |
1171 | 1171 | ||
1172 | /* | 1172 | /* |
1173 | * dev_WARN*() acts like dev_printk(), but with the key difference | 1173 | * dev_WARN*() acts like dev_printk(), but with the key difference of |
1174 | * of using a WARN/WARN_ON to get the message out, including the | 1174 | * using WARN/WARN_ONCE to include file/line information and a backtrace. |
1175 | * file/line information and a backtrace. | ||
1176 | */ | 1175 | */ |
1177 | #define dev_WARN(dev, format, arg...) \ | 1176 | #define dev_WARN(dev, format, arg...) \ |
1178 | WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg); | 1177 | WARN(1, "%s %s: " format, dev_driver_string(dev), dev_name(dev), ## arg); |
1179 | 1178 | ||
1180 | #define dev_WARN_ONCE(dev, condition, format, arg...) \ | 1179 | #define dev_WARN_ONCE(dev, condition, format, arg...) \ |
1181 | WARN_ONCE(condition, "Device %s\n" format, \ | 1180 | WARN_ONCE(condition, "%s %s: " format, \ |
1182 | dev_driver_string(dev), ## arg) | 1181 | dev_driver_string(dev), dev_name(dev), ## arg) |
1183 | 1182 | ||
1184 | /* Create alias, so I can be autoloaded. */ | 1183 | /* Create alias, so I can be autoloaded. */ |
1185 | #define MODULE_ALIAS_CHARDEV(major,minor) \ | 1184 | #define MODULE_ALIAS_CHARDEV(major,minor) \ |