1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>device_create_vargs</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-root-device-unregister.html" title="root_device_unregister"><link rel="next" href="API-device-create.html" title="device_create"></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">device_create_vargs</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-root-device-unregister.html">Prev</a>&#160;</td><th width="60%" align="center">Device Drivers Base</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-device-create.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-device-create-vargs"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>device_create_vargs &#8212; 
2     creates a device and registers it with sysfs
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">device_create_vargs </b>(</code></td><td>struct class * <var class="pdparam">class</var>, </td></tr><tr><td>&#160;</td><td>struct device * <var class="pdparam">parent</var>, </td></tr><tr><td>&#160;</td><td>dev_t <var class="pdparam">devt</var>, </td></tr><tr><td>&#160;</td><td>void * <var class="pdparam">drvdata</var>, </td></tr><tr><td>&#160;</td><td>const char * <var class="pdparam">fmt</var>, </td></tr><tr><td>&#160;</td><td>va_list <var class="pdparam">args</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1109407564"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>class</code></em></span></dt><dd><p>
4     pointer to the struct class that this device should be registered to
5    </p></dd><dt><span class="term"><em class="parameter"><code>parent</code></em></span></dt><dd><p>
6     pointer to the parent struct device of this new device, if any
7    </p></dd><dt><span class="term"><em class="parameter"><code>devt</code></em></span></dt><dd><p>
8     the dev_t for the char device to be added
9    </p></dd><dt><span class="term"><em class="parameter"><code>drvdata</code></em></span></dt><dd><p>
10     the data to be added to the device for callbacks
11    </p></dd><dt><span class="term"><em class="parameter"><code>fmt</code></em></span></dt><dd><p>
12     string for the device's name
13    </p></dd><dt><span class="term"><em class="parameter"><code>args</code></em></span></dt><dd><p>
14     va_list for the device's name
15    </p></dd></dl></div></div><div class="refsect1"><a name="idp1109414436"></a><h2>Description</h2><p>
16   This function can be used by char device classes.  A struct device
17   will be created in sysfs, registered to the specified class.
18   </p><p>
19
20   A <span class="quote">&#8220;<span class="quote">dev</span>&#8221;</span> file will be created, showing the dev_t for the device, if
21   the dev_t is not 0,0.
22   If a pointer to a parent struct device is passed in, the newly created
23   struct device will be a child of that device in sysfs.
24   The pointer to the struct device will be returned from the call.
25   Any further sysfs files that might be required can be created using this
26   pointer.
27   </p><p>
28
29   Returns <span class="structname">struct device</span> pointer on success, or <code class="function">ERR_PTR</code> on error.
30</p></div><div class="refsect1"><a name="idp1109416652"></a><h2>Note</h2><p>
31   the struct class passed to this function must have previously
32   been created with a call to <code class="function">class_create</code>.
33</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-root-device-unregister.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="ch02s02.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-device-create.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">root_device_unregister</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">device_create</span></td></tr></table></div></body></html>
34