Commit bcdd323b authored by Felipe Balbi's avatar Felipe Balbi Committed by Greg Kroah-Hartman

device: add dev_WARN_ONCE

it's quite useful to print the device name
on the stack dump caused by WARN(), but
there are other cases where we might want
to use WARN_ONCE.

Introduce a helper similar to dev_WARN() for
that case too.
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f0e615c3
...@@ -742,13 +742,17 @@ do { \ ...@@ -742,13 +742,17 @@ do { \
#endif #endif
/* /*
* dev_WARN() acts like dev_printk(), but with the key difference * dev_WARN*() acts like dev_printk(), but with the key difference
* of using a WARN/WARN_ON to get the message out, including the * of using a WARN/WARN_ON to get the message out, including the
* file/line information and a backtrace. * file/line information and a backtrace.
*/ */
#define dev_WARN(dev, format, arg...) \ #define dev_WARN(dev, format, arg...) \
WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg); WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg);
#define dev_WARN_ONCE(dev, condition, format, arg...) \
WARN_ONCE(condition, "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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment