summaryrefslogtreecommitdiff
path: root/include/sound/core.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-08-08 17:06:01 +0200
committerJaroslav Kysela <perex@perex.cz>2008-08-13 11:46:32 +0200
commit5ef03460a6ffc1d3ee6b6f2abc6765d3e224cf89 (patch)
tree1947acad9b61fa80567fa1dd20c5b8c65ff8a46d /include/sound/core.h
parent3caf8c080ef0bd0ccdc20bb57b150b6e40a86fd3 (diff)
ALSA: Introduce snd_BUG_ON() macro
Introduced snd_BUG_ON() macro as a replacement of snd_assert() macro. snd_assert() is pretty ugly as it has the control flow in its argument. OTOH, snd_BUG_ON() behaves like a normal conditional, thus it's much easier to read the flow. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'include/sound/core.h')
-rw-r--r--include/sound/core.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/sound/core.h b/include/sound/core.h
index 1a4ff0bdcf6a..938c36a0e874 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -28,6 +28,7 @@
#include <linux/rwsem.h> /* struct rw_semaphore */
#include <linux/pm.h> /* pm_message_t */
#include <linux/device.h>
+#include <linux/stringify.h>
/* 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 */