1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Chapter&#160;16.&#160;Useful Functions</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Writing an ALSA Driver"><link rel="up" href="index.html" title="Writing an ALSA Driver"><link rel="prev" href="ch15s03.html" title="Drivers with Several Source Files"><link rel="next" href="useful-functions-snd-bug.html" title="snd_BUG()"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&#160;16.&#160;Useful Functions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch15s03.html">Prev</a>&#160;</td><th width="60%" align="center">&#160;</th><td width="20%" align="right">&#160;<a accesskey="n" href="useful-functions-snd-bug.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="useful-functions"></a>Chapter&#160;16.&#160;Useful Functions</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="useful-functions.html#useful-functions-snd-printk"><code class="function">snd_printk()</code> and friends</a></span></dt><dt><span class="section"><a href="useful-functions-snd-bug.html"><code class="function">snd_BUG()</code></a></span></dt><dt><span class="section"><a href="useful-functions-snd-bug-on.html"><code class="function">snd_BUG_ON()</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="useful-functions-snd-printk"></a><code class="function">snd_printk()</code> and friends</h2></div></div></div><p>
2        ALSA provides a verbose version of the
3      <code class="function">printk()</code> function. If a kernel config
4      <code class="constant">CONFIG_SND_VERBOSE_PRINTK</code> is set, this
5      function prints the given message together with the file name
6      and the line of the caller. The <code class="constant">KERN_XXX</code>
7      prefix is processed as 
8      well as the original <code class="function">printk()</code> does, so it's
9      recommended to add this prefix, e.g. 
10
11        </p><div class="informalexample"><pre class="programlisting">
12
13  snd_printk(KERN_ERR "Oh my, sorry, it's extremely bad!\n");
14
15          </pre></div><p>
16      </p><p>
17        There are also <code class="function">printk()</code>'s for
18      debugging. <code class="function">snd_printd()</code> can be used for
19      general debugging purposes. If
20      <code class="constant">CONFIG_SND_DEBUG</code> is set, this function is
21      compiled, and works just like
22      <code class="function">snd_printk()</code>. If the ALSA is compiled
23      without the debugging flag, it's ignored. 
24      </p><p>
25        <code class="function">snd_printdd()</code> is compiled in only when
26      <code class="constant">CONFIG_SND_DEBUG_VERBOSE</code> is set. Please note
27      that <code class="constant">CONFIG_SND_DEBUG_VERBOSE</code> is not set as default
28      even if you configure the alsa-driver with
29      <code class="option">--with-debug=full</code> option. You need to give
30      explicitly <code class="option">--with-debug=detect</code> option instead. 
31      </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch15s03.html">Prev</a>&#160;</td><td width="20%" align="center">&#160;</td><td width="40%" align="right">&#160;<a accesskey="n" href="useful-functions-snd-bug.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Drivers with Several Source Files&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<code class="function">snd_BUG()</code></td></tr></table></div></body></html>
32