'\" t .\" Title: usb_lock_device_for_reset .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: January 2017 .\" Manual: USB Core APIs .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "USB_LOCK_DEVICE_FOR_" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "USB Core APIs" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" usb_lock_device_for_reset \- cautiously acquire the lock for a usb device structure .SH "SYNOPSIS" .HP \w'int\ usb_lock_device_for_reset('u .BI "int usb_lock_device_for_reset(struct\ usb_device\ *\ " "udev" ", const\ struct\ usb_interface\ *\ " "iface" ");" .SH "ARGUMENTS" .PP \fIudev\fR .RS 4 device that\*(Aqs being locked .RE .PP \fIiface\fR .RS 4 interface bound to the driver making the request (optional) .RE .SH "DESCRIPTION" .PP Attempts to acquire the device lock, but fails if the device is NOTATTACHED or SUSPENDED, or if iface is specified and the interface is neither BINDING nor BOUND\&. Rather than sleeping to wait for the lock, the routine polls repeatedly\&. This is to prevent deadlock with disconnect; in some drivers (such as usb\-storage) the \fBdisconnect\fR or \fBsuspend\fR method will block waiting for a device reset to complete\&. .SH "RETURN" .PP A negative error code for failure, otherwise 0\&. .SH "COPYRIGHT" .br