1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>__root_device_register</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="ch02s02.html" title="Device Drivers Base"><link rel="prev" href="API-device-find-child.html" title="device_find_child"><link rel="next" href="API-root-device-unregister.html" title="root_device_unregister"></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">__root_device_register</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-device-find-child.html">Prev</a> </td><th width="60%" align="center">Device Drivers Base</th><td width="20%" align="right"> <a accesskey="n" href="API-root-device-unregister.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API---root-device-register"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>__root_device_register — 2 allocate and register a root 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">struct device * <b class="fsfunc">__root_device_register </b>(</code></td><td>const char * <var class="pdparam">name</var>, </td></tr><tr><td> </td><td>struct module * <var class="pdparam">owner</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1109386148"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>name</code></em></span></dt><dd><p> 4 root device name 5 </p></dd><dt><span class="term"><em class="parameter"><code>owner</code></em></span></dt><dd><p> 6 owner module of the root device, usually THIS_MODULE 7 </p></dd></dl></div></div><div class="refsect1"><a name="idp1109388812"></a><h2>Description</h2><p> 8 This function allocates a root device and registers it 9 using <code class="function">device_register</code>. In order to free the returned 10 device, use <code class="function">root_device_unregister</code>. 11 </p><p> 12 13 Root devices are dummy devices which allow other devices 14 to be grouped under /sys/devices. Use this function to 15 allocate a root device and then use it as the parent of 16 any device which should appear under /sys/devices/{name} 17 </p><p> 18 19 The /sys/devices/{name} directory will also contain a 20 'module' symlink which points to the <em class="parameter"><code>owner</code></em> directory 21 in sysfs. 22 </p><p> 23 24 Returns <span class="structname">struct device</span> pointer on success, or <code class="function">ERR_PTR</code> on error. 25</p></div><div class="refsect1"><a name="idp1109392012"></a><h2>Note</h2><p> 26 You probably want to use <code class="function">root_device_register</code>. 27</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-device-find-child.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02s02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-root-device-unregister.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">device_find_child</span> </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">root_device_unregister</span></td></tr></table></div></body></html> 28