USB_LOCK_DEVICE_FOR_RESET

Section: (9)
Updated: 09 October 2005
Index Return to Main Contents

 

NAME

usb_lock_device_for_reset - cautiously acquire the lock for a  

SYNOPSIS

"SYNOPSIS"

int usb_lock_device_for_reset (struct usb_device * udev, struct usb_interface * iface);  

ARGUMENTS

udev
device that's being locked
iface
interface bound to the driver making the request (optional)
 

DESCRIPTION

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 disconnect callback will block waiting for a device reset to complete.

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.)  

DESCRIPTION

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 disconnect callback will block waiting for a device reset to complete.

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.)


 

Index

NAME
SYNOPSIS
ARGUMENTS
DESCRIPTION
DESCRIPTION

This document was created by man2html, using the manual pages.
Time: 00:02:57 GMT, October 09, 2005