diff options
Diffstat (limited to 'Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl')
-rw-r--r-- | Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | 56 |
1 files changed, 15 insertions, 41 deletions
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl index 24e85520890b..260334c98d95 100644 --- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | |||
@@ -18,8 +18,8 @@ | |||
18 | </affiliation> | 18 | </affiliation> |
19 | </author> | 19 | </author> |
20 | 20 | ||
21 | <date>March 6, 2005</date> | 21 | <date>October 6, 2005</date> |
22 | <edition>0.3.4</edition> | 22 | <edition>0.3.5</edition> |
23 | 23 | ||
24 | <abstract> | 24 | <abstract> |
25 | <para> | 25 | <para> |
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | <legalnotice> | 31 | <legalnotice> |
32 | <para> | 32 | <para> |
33 | Copyright (c) 2002-2004 Takashi Iwai <email>tiwai@suse.de</email> | 33 | Copyright (c) 2002-2005 Takashi Iwai <email>tiwai@suse.de</email> |
34 | </para> | 34 | </para> |
35 | 35 | ||
36 | <para> | 36 | <para> |
@@ -1433,25 +1433,10 @@ | |||
1433 | <informalexample> | 1433 | <informalexample> |
1434 | <programlisting> | 1434 | <programlisting> |
1435 | <![CDATA[ | 1435 | <![CDATA[ |
1436 | if (chip->res_port) { | 1436 | release_and_free_resource(chip->res_port); |
1437 | release_resource(chip->res_port); | ||
1438 | kfree_nocheck(chip->res_port); | ||
1439 | } | ||
1440 | ]]> | 1437 | ]]> |
1441 | </programlisting> | 1438 | </programlisting> |
1442 | </informalexample> | 1439 | </informalexample> |
1443 | |||
1444 | As you can see, the resource pointer is also to be freed | ||
1445 | via <function>kfree_nocheck()</function> after | ||
1446 | <function>release_resource()</function> is called. You | ||
1447 | cannot use <function>kfree()</function> here, because on ALSA, | ||
1448 | <function>kfree()</function> may be a wrapper to its own | ||
1449 | allocator with the memory debugging. Since the resource pointer | ||
1450 | is allocated externally outside the ALSA, it must be released | ||
1451 | via the native | ||
1452 | <function>kfree()</function>. | ||
1453 | <function>kfree_nocheck()</function> is used for that; it calls | ||
1454 | the native <function>kfree()</function> without wrapper. | ||
1455 | </para> | 1440 | </para> |
1456 | 1441 | ||
1457 | <para> | 1442 | <para> |
@@ -2190,8 +2175,7 @@ struct _snd_pcm_runtime { | |||
2190 | unsigned int rate_den; | 2175 | unsigned int rate_den; |
2191 | 2176 | ||
2192 | /* -- SW params -- */ | 2177 | /* -- SW params -- */ |
2193 | int tstamp_timespec; /* use timeval (0) or timespec (1) */ | 2178 | struct timespec tstamp_mode; /* mmap timestamp is updated */ |
2194 | snd_pcm_tstamp_t tstamp_mode; /* mmap timestamp is updated */ | ||
2195 | unsigned int period_step; | 2179 | unsigned int period_step; |
2196 | unsigned int sleep_min; /* min ticks to sleep */ | 2180 | unsigned int sleep_min; /* min ticks to sleep */ |
2197 | snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ | 2181 | snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ |
@@ -3709,8 +3693,7 @@ struct _snd_pcm_runtime { | |||
3709 | <para> | 3693 | <para> |
3710 | Here, the chip instance is retrieved via | 3694 | Here, the chip instance is retrieved via |
3711 | <function>snd_kcontrol_chip()</function> macro. This macro | 3695 | <function>snd_kcontrol_chip()</function> macro. This macro |
3712 | converts from kcontrol->private_data to the type defined by | 3696 | just accesses to kcontrol->private_data. The |
3713 | <type>chip_t</type>. The | ||
3714 | kcontrol->private_data field is | 3697 | kcontrol->private_data field is |
3715 | given as the argument of <function>snd_ctl_new()</function> | 3698 | given as the argument of <function>snd_ctl_new()</function> |
3716 | (see the later subsection | 3699 | (see the later subsection |
@@ -5998,32 +5981,23 @@ struct _snd_pcm_runtime { | |||
5998 | The first argument is the expression to evaluate, and the | 5981 | The first argument is the expression to evaluate, and the |
5999 | second argument is the action if it fails. When | 5982 | second argument is the action if it fails. When |
6000 | <constant>CONFIG_SND_DEBUG</constant>, is set, it will show an | 5983 | <constant>CONFIG_SND_DEBUG</constant>, is set, it will show an |
6001 | error message such as <computeroutput>BUG? (xxx) (called from | 5984 | error message such as <computeroutput>BUG? (xxx)</computeroutput> |
6002 | yyy)</computeroutput>. When no debug flag is set, this is | 5985 | together with stack trace. |
6003 | ignored. | ||
6004 | </para> | 5986 | </para> |
6005 | </section> | ||
6006 | |||
6007 | <section id="useful-functions-snd-runtime-check"> | ||
6008 | <title><function>snd_runtime_check()</function></title> | ||
6009 | <para> | 5987 | <para> |
6010 | This macro is quite similar with | 5988 | When no debug flag is set, this macro is ignored. |
6011 | <function>snd_assert()</function>. Unlike | ||
6012 | <function>snd_assert()</function>, the expression is always | ||
6013 | evaluated regardless of | ||
6014 | <constant>CONFIG_SND_DEBUG</constant>. When | ||
6015 | <constant>CONFIG_SND_DEBUG</constant> is set, the macro will | ||
6016 | show a message like <computeroutput>ERROR (xx) (called from | ||
6017 | yyy)</computeroutput>. | ||
6018 | </para> | 5989 | </para> |
6019 | </section> | 5990 | </section> |
6020 | 5991 | ||
6021 | <section id="useful-functions-snd-bug"> | 5992 | <section id="useful-functions-snd-bug"> |
6022 | <title><function>snd_BUG()</function></title> | 5993 | <title><function>snd_BUG()</function></title> |
6023 | <para> | 5994 | <para> |
6024 | It calls <function>snd_assert(0,)</function> -- that is, just | 5995 | It shows <computeroutput>BUG?</computeroutput> message and |
6025 | prints the error message at the point. It's useful to show that | 5996 | stack trace as well as <function>snd_assert</function> at the point. |
6026 | a fatal error happens there. | 5997 | It's useful to show that a fatal error happens there. |
5998 | </para> | ||
5999 | <para> | ||
6000 | When no debug flag is set, this macro is ignored. | ||
6027 | </para> | 6001 | </para> |
6028 | </section> | 6002 | </section> |
6029 | </chapter> | 6003 | </chapter> |