diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
index e13c4e67029f497899d4cbc545f67fd073d36e1f..df699e4323ef62a3cfe3afce586d5e4d8b225eae 100644
--- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
+++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
@@ -6173,6 +6173,47 @@ struct _snd_pcm_runtime {
When no debug flag is set, this macro is ignored.
+
+
+ snd_BUG_ON()
+
+ snd_BUG_ON() macro is similar with
+ WARN_ON() macro. For example,
+
+
+
+
+
+
+
+ or it can be used as the condition,
+
+
+
+
+
+
+
+
+
+ The macro takes an conditional expression to evaluate.
+ When CONFIG_SND_DEBUG, is set, the
+ expression is actually evaluated. If it's non-zero, it shows
+ the warning message such as
+ BUG? (xxx)
+ normally followed by stack trace. It returns the evaluated
+ value.
+ When no CONFIG_SND_DEBUG is set, this
+ macro always returns zero.
+
+
+
+
diff --git a/include/sound/core.h b/include/sound/core.h
index 1a4ff0bdcf6ab45fa8dc0e50c80daa9c742b40d7..938c36a0e874f5514ad1fdbedc753a68de2b6603 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -28,6 +28,7 @@
#include /* struct rw_semaphore */
#include /* pm_message_t */
#include
+#include
/* number of supported soundcards */
#ifdef CONFIG_SND_DYNAMIC_MINORS
@@ -405,11 +406,14 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
dump_stack(); \
} while (0)
+#define snd_BUG_ON(cond) WARN((cond), "BUG? (%s)\n", __stringify(cond))
+
#else /* !CONFIG_SND_DEBUG */
#define snd_printd(fmt, args...) /* nothing */
#define snd_assert(expr, args...) (void)(expr)
#define snd_BUG() /* nothing */
+#define snd_BUG_ON(cond) ({/*(void)(cond);*/ 0;}) /* always false */
#endif /* CONFIG_SND_DEBUG */