1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Exit function</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="MTD NAND Driver Programming Interface"><link rel="up" href="basicboarddriver.html" title="Chapter&#160;4.&#160;Basic board driver"><link rel="prev" href="Init_function.html" title="Init function"><link rel="next" href="boarddriversadvanced.html" title="Chapter&#160;5.&#160;Advanced board driver functions"></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">Exit function</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="Init_function.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;4.&#160;Basic board driver</th><td width="20%" align="right">&#160;<a accesskey="n" href="boarddriversadvanced.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="Exit_function"></a>Exit function</h2></div></div></div><p>
2			The exit function is only necessary if the driver is
3			compiled as a module. It releases all resources which
4			are held by the chip driver and unregisters the partitions
5			in the MTD layer.
6		</p><pre class="programlisting">
7#ifdef MODULE
8static void __exit board_cleanup (void)
9{
10	/* Release resources, unregister device */
11	nand_release (board_mtd);
12
13	/* unmap physical address */
14	iounmap(baseaddr);
15	
16	/* Free the MTD device structure */
17	kfree (board_mtd);
18}
19module_exit(board_cleanup);
20#endif
21		</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="Init_function.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="basicboarddriver.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="boarddriversadvanced.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Init function&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Chapter&#160;5.&#160;Advanced board driver functions</td></tr></table></div></body></html>
22