Loading Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +1 −28 Original line number Diff line number Diff line Loading @@ -6135,38 +6135,11 @@ struct _snd_pcm_runtime { </para> </section> <section id="useful-functions-snd-assert"> <title><function>snd_assert()</function></title> <para> <function>snd_assert()</function> macro is similar with the normal <function>assert()</function> macro. For example, <informalexample> <programlisting> <![CDATA[ snd_assert(pointer != NULL, return -EINVAL); ]]> </programlisting> </informalexample> </para> <para> The first argument is the expression to evaluate, and the second argument is the action if it fails. When <constant>CONFIG_SND_DEBUG</constant>, is set, it will show an error message such as <computeroutput>BUG? (xxx)</computeroutput> together with stack trace. </para> <para> When no debug flag is set, this macro is ignored. </para> </section> <section id="useful-functions-snd-bug"> <title><function>snd_BUG()</function></title> <para> It shows the <computeroutput>BUG?</computeroutput> message and stack trace as well as <function>snd_assert</function> at the point. stack trace as well as <function>snd_BUG_ON</function> at the point. It's useful to show that a fatal error happens there. </para> <para> Loading include/sound/core.h +0 −19 Original line number Diff line number Diff line Loading @@ -368,8 +368,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) #ifdef CONFIG_SND_DEBUG #define __ASTRING__(x) #x #ifdef CONFIG_SND_VERBOSE_PRINTK /** * snd_printd - debug printk Loading @@ -384,22 +382,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) #define snd_printd(fmt, args...) \ printk(fmt ,##args) #endif /** * snd_assert - run-time assertion macro * @expr: expression * * This macro checks the expression in run-time and invokes the commands * given in the rest arguments if the assertion is failed. * When CONFIG_SND_DEBUG is not set, the expression is executed but * not checked. */ #define snd_assert(expr, args...) do { \ if (unlikely(!(expr))) { \ snd_printk(KERN_ERR "BUG? (%s)\n", __ASTRING__(expr)); \ dump_stack(); \ args; \ } \ } while (0) #define snd_BUG() do { \ snd_printk(KERN_ERR "BUG?\n"); \ Loading @@ -411,7 +393,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) #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 */ Loading Loading
Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +1 −28 Original line number Diff line number Diff line Loading @@ -6135,38 +6135,11 @@ struct _snd_pcm_runtime { </para> </section> <section id="useful-functions-snd-assert"> <title><function>snd_assert()</function></title> <para> <function>snd_assert()</function> macro is similar with the normal <function>assert()</function> macro. For example, <informalexample> <programlisting> <![CDATA[ snd_assert(pointer != NULL, return -EINVAL); ]]> </programlisting> </informalexample> </para> <para> The first argument is the expression to evaluate, and the second argument is the action if it fails. When <constant>CONFIG_SND_DEBUG</constant>, is set, it will show an error message such as <computeroutput>BUG? (xxx)</computeroutput> together with stack trace. </para> <para> When no debug flag is set, this macro is ignored. </para> </section> <section id="useful-functions-snd-bug"> <title><function>snd_BUG()</function></title> <para> It shows the <computeroutput>BUG?</computeroutput> message and stack trace as well as <function>snd_assert</function> at the point. stack trace as well as <function>snd_BUG_ON</function> at the point. It's useful to show that a fatal error happens there. </para> <para> Loading
include/sound/core.h +0 −19 Original line number Diff line number Diff line Loading @@ -368,8 +368,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) #ifdef CONFIG_SND_DEBUG #define __ASTRING__(x) #x #ifdef CONFIG_SND_VERBOSE_PRINTK /** * snd_printd - debug printk Loading @@ -384,22 +382,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) #define snd_printd(fmt, args...) \ printk(fmt ,##args) #endif /** * snd_assert - run-time assertion macro * @expr: expression * * This macro checks the expression in run-time and invokes the commands * given in the rest arguments if the assertion is failed. * When CONFIG_SND_DEBUG is not set, the expression is executed but * not checked. */ #define snd_assert(expr, args...) do { \ if (unlikely(!(expr))) { \ snd_printk(KERN_ERR "BUG? (%s)\n", __ASTRING__(expr)); \ dump_stack(); \ args; \ } \ } while (0) #define snd_BUG() do { \ snd_printk(KERN_ERR "BUG?\n"); \ Loading @@ -411,7 +393,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) #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 */ Loading