]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
device: add dev_WARN_ONCE
authorFelipe Balbi <balbi@ti.com>
Wed, 16 Mar 2011 13:59:35 +0000 (15:59 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 19 Apr 2011 23:45:50 +0000 (16:45 -0700)
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: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
include/linux/device.h

index ab8dfc095709674c9afca67152af5c651f1e2d03..d4840511e877d1ccd77792214ce54b649cf04668 100644 (file)
@@ -742,13 +742,17 @@ do {                                                   \
 #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
  * file/line information and a backtrace.
  */
 #define dev_WARN(dev, format, 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. */
 #define MODULE_ALIAS_CHARDEV(major,minor) \
        MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))