aboutsummaryrefslogtreecommitdiff
path: root/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl')
-rw-r--r--Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl65
1 files changed, 39 insertions, 26 deletions
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
index e13c4e67029..87a7c07ab65 100644
--- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
+++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
@@ -5073,8 +5073,7 @@ struct _snd_pcm_runtime {
with <constant>SNDRV_DMA_TYPE_CONTINUOUS</constant> type and the
<function>snd_dma_continuous_data(GFP_KERNEL)</function> device pointer,
where <constant>GFP_KERNEL</constant> is the kernel allocation flag to
- use. For the SBUS, <constant>SNDRV_DMA_TYPE_SBUS</constant> and
- <function>snd_dma_sbus_data(sbus_dev)</function> are used instead.
+ use.
For the PCI scatter-gather buffers, use
<constant>SNDRV_DMA_TYPE_DEV_SG</constant> with
<function>snd_dma_pci_data(pci)</function>
@@ -6135,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>