1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Destructor</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="basic-flow.html" title="Chapter&#160;2.&#160;Basic Flow for PCI Drivers"><link rel="prev" href="basic-flow-constructor.html" title="Constructor"><link rel="next" href="basic-flow-header-files.html" title="Header Files"></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">Destructor</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="basic-flow-constructor.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;2.&#160;Basic Flow for PCI Drivers</th><td width="20%" align="right">&#160;<a accesskey="n" href="basic-flow-header-files.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="basic-flow-destructor"></a>Destructor</h2></div></div></div><p>
2        The destructor, remove callback, simply releases the card
3      instance. Then the ALSA middle layer will release all the
4      attached components automatically. 
5      </p><p>
6        It would be typically like the following:
7
8        </p><div class="informalexample"><pre class="programlisting">
9
10  static void snd_mychip_remove(struct pci_dev *pci)
11  {
12          snd_card_free(pci_get_drvdata(pci));
13          pci_set_drvdata(pci, NULL);
14  }
15
16          </pre></div><p>
17
18        The above code assumes that the card pointer is set to the PCI
19	driver data.
20      </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="basic-flow-constructor.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="basic-flow.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="basic-flow-header-files.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Constructor&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Header Files</td></tr></table></div></body></html>
21