1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>misc_register</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The Linux Kernel API"><link rel="up" href="miscdev.html" title="Chapter 16. Miscellaneous Devices"><link rel="prev" href="miscdev.html" title="Chapter 16. Miscellaneous Devices"><link rel="next" href="API-misc-deregister.html" title="misc_deregister"></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"><span class="phrase">misc_register</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="miscdev.html">Prev</a> </td><th width="60%" align="center">Chapter 16. Miscellaneous Devices</th><td width="20%" align="right"> <a accesskey="n" href="API-misc-deregister.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-misc-register"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>misc_register — 2 register a miscellaneous device 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">misc_register </b>(</code></td><td>struct miscdevice * <var class="pdparam">misc</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1129167748"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>misc</code></em></span></dt><dd><p> 4 device structure 5 </p><p> 6 7 Register a miscellaneous device with the kernel. If the minor 8 number is set to <code class="constant">MISC_DYNAMIC_MINOR</code> a minor number is assigned 9 and placed in the minor field of the structure. For other cases 10 the minor number requested is used. 11 </p></dd></dl></div></div><div class="refsect1"><a name="idp1129169956"></a><h2>Description</h2><p> 12 The structure passed is linked into the kernel and may not be 13 destroyed until it has been unregistered. By default, an <code class="function">open</code> 14 syscall to the device sets file->private_data to point to the 15 structure. Drivers don't need open in fops for this. 16 </p><p> 17 18 A zero is returned on success and a negative errno code for 19 failure. 20</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="miscdev.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="miscdev.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-misc-deregister.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 16. Miscellaneous Devices </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">misc_deregister</span></td></tr></table></div></body></html> 21