1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>usb_lock_device_for_reset</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The Linux-USB Host Side API"><link rel="up" href="usbcore.html" title="Chapter 5. USB Core APIs"><link rel="prev" href="API-usb-put-intf.html" title="usb_put_intf"><link rel="next" href="API-usb-get-current-frame-number.html" title="usb_get_current_frame_number"></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">usb_lock_device_for_reset</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-usb-put-intf.html">Prev</a> </td><th width="60%" align="center">Chapter 5. USB Core APIs</th><td width="20%" align="right"> <a accesskey="n" href="API-usb-get-current-frame-number.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-usb-lock-device-for-reset"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>usb_lock_device_for_reset — 2 cautiously acquire the lock for a usb device structure 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">usb_lock_device_for_reset </b>(</code></td><td>struct usb_device * <var class="pdparam">udev</var>, </td></tr><tr><td> </td><td>const struct usb_interface * <var class="pdparam">iface</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1116546644"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>udev</code></em></span></dt><dd><p> 4 device that's being locked 5 </p></dd><dt><span class="term"><em class="parameter"><code>iface</code></em></span></dt><dd><p> 6 interface bound to the driver making the request (optional) 7 </p></dd></dl></div></div><div class="refsect1"><a name="idp1116549252"></a><h2>Description</h2><p> 8 Attempts to acquire the device lock, but fails if the device is 9 NOTATTACHED or SUSPENDED, or if iface is specified and the interface 10 is neither BINDING nor BOUND. Rather than sleeping to wait for the 11 lock, the routine polls repeatedly. This is to prevent deadlock with 12 disconnect; in some drivers (such as usb-storage) the <code class="function">disconnect</code> 13 or <code class="function">suspend</code> method will block waiting for a device reset to complete. 14</p></div><div class="refsect1"><a name="idp1116550868"></a><h2>Return</h2><p> 15 A negative error code for failure, otherwise 0. 16</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-usb-put-intf.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="usbcore.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-usb-get-current-frame-number.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">usb_put_intf</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">usb_get_current_frame_number</span></td></tr></table></div></body></html> 17