lkml.org 
[lkml]   [2011]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] device: add dev_WARN_ONCE
Date
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>
---
include/linux/device.h | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index 1bf5cf0..83870b8 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -739,13 +739,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))
--
1.7.4.rc2


\
 
 \ /
  Last update: 2011-03-16 15:01    [W:0.090 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site