1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>module_exit() include/linux/init.h</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Unreliable Guide To Hacking The Linux Kernel"><link rel="up" href="common-routines.html" title="Chapter 6. Common Routines"><link rel="prev" href="routines-init-again.html" title="__initcall()/module_init() include/linux/init.h"><link rel="next" href="routines-module-use-counters.html" title="try_module_get()/module_put() include/linux/module.h"></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"> <code class="function">module_exit()</code> 2 <code class="filename">include/linux/init.h</code> </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="routines-init-again.html">Prev</a> </td><th width="60%" align="center">Chapter 6. Common Routines</th><td width="20%" align="right"> <a accesskey="n" href="routines-module-use-counters.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="routines-moduleexit"></a> <code class="function">module_exit()</code> 3 <code class="filename">include/linux/init.h</code> </h2></div></div></div><p> 4 This macro defines the function to be called at module removal 5 time (or never, in the case of the file compiled into the 6 kernel). It will only be called if the module usage count has 7 reached zero. This function can also sleep, but cannot fail: 8 everything must be cleaned up by the time it returns. 9 </p><p> 10 Note that this macro is optional: if it is not present, your 11 module will not be removable (except for 'rmmod -f'). 12 </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="routines-init-again.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="common-routines.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="routines-module-use-counters.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><code class="function">__initcall()</code>/<code class="function">module_init()</code> 13 <code class="filename">include/linux/init.h</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">  <code class="function">try_module_get()</code>/<code class="function">module_put()</code> 14 <code class="filename">include/linux/module.h</code></td></tr></table></div></body></html> 15