diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2008-09-20 22:08:39 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-10-16 12:24:50 -0400 |
commit | e61396627f91abb855ddd8925be9172fb5871944 (patch) | |
tree | c6a05c04a4ec4b8f554ff372f559316e92112244 | |
parent | b31ca3f5dfc89c3f1f654b30f0760d0e2fb15e45 (diff) |
debug: Introduce a dev_WARN() function
in the line of dev_printk(), this patch introduces a dev_WARN() function,
that takes a struct device and then a printk format/args set of arguments.
Unlike dev_printk(), the effect is that of WARN() in that a full warning
message (including filename/line, module list, versions and a backtrace)
is printed in addition to the device name and the arguments.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | include/linux/device.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index fb034461b395..ec90e79f6a00 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -570,6 +570,14 @@ extern const char *dev_driver_string(const struct device *dev); | |||
570 | ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; }) | 570 | ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; }) |
571 | #endif | 571 | #endif |
572 | 572 | ||
573 | /* | ||
574 | * dev_WARN() acts like dev_printk(), but with the key difference | ||
575 | * of using a WARN/WARN_ON to get the message out, including the | ||
576 | * file/line information and a backtrace. | ||
577 | */ | ||
578 | #define dev_WARN(dev, format, arg...) \ | ||
579 | WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg); | ||
580 | |||
573 | /* Create alias, so I can be autoloaded. */ | 581 | /* Create alias, so I can be autoloaded. */ |
574 | #define MODULE_ALIAS_CHARDEV(major,minor) \ | 582 | #define MODULE_ALIAS_CHARDEV(major,minor) \ |
575 | MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) | 583 | MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) |