]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
ALSA: Kill snd_assert() definition
[linux-2.6-omap-h63xx.git] / Documentation / sound / alsa / DocBook / writing-an-alsa-driver.tmpl
index e13c4e67029f497899d4cbc545f67fd073d36e1f..b54cb5048dfa8c1f23176382cf31d2f1b409e15b 100644 (file)
@@ -6135,44 +6135,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>