.\" This manpage has been automatically generated by docbook2man
.\" from a DocBook document. This tool can be found at:
.\"
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng .
.TH "USB_LOCK_DEVICE_FOR_RESET" "9" "09 October 2005" "" ""
.SH NAME
usb_lock_device_for_reset \- cautiously acquire the lock for a
.SH SYNOPSIS
"SYNOPSIS"
.sp
\fB
.sp
int usb_lock_device_for_reset (struct usb_device * \fIudev\fB, struct usb_interface * \fIiface\fB);
\fR
.SH "ARGUMENTS"
.TP
\fB\fIudev\fB\fR
device that's being locked
.TP
\fB\fIiface\fB\fR
interface bound to the driver making the request (optional)
.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
callback will block waiting for a device reset to complete.
.PP
Returns a negative error code for failure, otherwise 1 or 0 to indicate
that the device will or will not have to be unlocked. (0 can be
returned when an interface is given and is BINDING, because in that
case the driver already owns the device lock.)
.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
callback will block waiting for a device reset to complete.
.PP
Returns a negative error code for failure, otherwise 1 or 0 to indicate
that the device will or will not have to be unlocked. (0 can be
returned when an interface is given and is BINDING, because in that
case the driver already owns the device lock.)