diff options
author | David S. Miller <davem@davemloft.net> | 2008-10-11 23:39:35 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-11 23:39:35 +0400 |
commit | 56c5d900dbb8e042bfad035d18433476931d8f93 (patch) | |
tree | 00b793965beeef10db03e0ff021d2d965c410759 /Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | |
parent | 4dd95b63ae25c5cad6986829b5e8788e9faa0330 (diff) | |
parent | ead9d23d803ea3a73766c3cb27bf7563ac8d7266 (diff) | |
download | linux-56c5d900dbb8e042bfad035d18433476931d8f93.tar.xz |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
sound/core/memalloc.c
Diffstat (limited to 'Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl')
-rw-r--r-- | Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | 62 |
1 files changed, 38 insertions, 24 deletions
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl index 56723b42813e..87a7c07ab658 100644 --- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl @@ -6134,44 +6134,58 @@ struct _snd_pcm_runtime { </para> </section> - <section id="useful-functions-snd-assert"> - <title><function>snd_assert()</function></title> + <section id="useful-functions-snd-bug"> + <title><function>snd_BUG()</function></title> <para> - <function>snd_assert()</function> macro is similar with the - normal <function>assert()</function> macro. For example, + It shows the <computeroutput>BUG?</computeroutput> message and + 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> + When no debug flag is set, this macro is ignored. + </para> + </section> + + <section id="useful-functions-snd-bug-on"> + <title><function>snd_BUG_ON()</function></title> + <para> + <function>snd_BUG_ON()</function> macro is similar with + <function>WARN_ON()</function> macro. For example, <informalexample> <programlisting> <![CDATA[ - snd_assert(pointer != NULL, return -EINVAL); + snd_BUG_ON(!pointer); ]]> </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> + or it can be used as the condition, + <informalexample> + <programlisting> +<![CDATA[ + if (snd_BUG_ON(non_zero_is_bug)) + return -EINVAL; +]]> + </programlisting> + </informalexample> - <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. - It's useful to show that a fatal error happens there. </para> + <para> - When no debug flag is set, this macro is ignored. + The macro takes an conditional expression to evaluate. + When <constant>CONFIG_SND_DEBUG</constant>, is set, the + expression is actually evaluated. If it's non-zero, it shows + the warning message such as + <computeroutput>BUG? (xxx)</computeroutput> + normally followed by stack trace. It returns the evaluated + value. + When no <constant>CONFIG_SND_DEBUG</constant> is set, this + macro always returns zero. </para> + </section> + </chapter> |