提交 e6139662 编写于 作者: A Arjan van de Ven 提交者: Greg Kroah-Hartman

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: NArjan van de Ven <arjan@linux.intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 b31ca3f5
...@@ -570,6 +570,14 @@ extern const char *dev_driver_string(const struct device *dev); ...@@ -570,6 +570,14 @@ extern const char *dev_driver_string(const struct device *dev);
({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; }) ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
#endif #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.
*/
#define dev_WARN(dev, format, arg...) \
WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg);
/* Create alias, so I can be autoloaded. */ /* Create alias, so I can be autoloaded. */
#define MODULE_ALIAS_CHARDEV(major,minor) \ #define MODULE_ALIAS_CHARDEV(major,minor) \
MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册