summaryrefslogtreecommitdiff
path: root/include/linux/usb.h
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2004-09-13 20:34:46 -0700
committerGreg Kroah-Hartman <greg@kroah.com>2004-09-13 20:34:46 -0700
commit7d8d0405f07a1777cad6898346127b478b68dd0e (patch)
treec4949a22ed9097deb051f1d343bc615a1e44c755 /include/linux/usb.h
parent11c763cc105faf3f3148fa209b87ded8bb1fa07e (diff)
[PATCH] USB: Add locking support for USB device resets
This patch reintroduces the usb_lock_device_for_reset() routine, which is specially tailored to meet the needs of drivers that have to reset a device either during probe() or during normal operations. It updates a few drivers that do device resets, to make them use the new routine. It also adds a new field to struct usb_interface, to keep track of whether the interface is in the process of being bound to or unbound from a driver. This is necessary, because during binding we know the device is already locked so we don't want to try to acquire the lock again! With this patch in place, USB device resets should finally become reliable. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r--include/linux/usb.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 67a8d7bce43b..18ee0751a32b 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -61,6 +61,13 @@ struct usb_host_interface {
int extralen;
};
+enum usb_interface_condition {
+ USB_INTERFACE_UNBOUND = 0,
+ USB_INTERFACE_BINDING,
+ USB_INTERFACE_BOUND,
+ USB_INTERFACE_UNBINDING,
+};
+
/**
* struct usb_interface - what usb device drivers talk to
* @altsetting: array of interface structures, one for each alternate
@@ -75,6 +82,8 @@ struct usb_host_interface {
* be unused. The driver should set this value in the probe()
* function of the driver, after it has been assigned a minor
* number from the USB core by calling usb_register_dev().
+ * @condition: binding state of the interface: not bound, binding
+ * (in probe()), bound to a driver, or unbinding (in disconnect())
* @dev: driver model's view of this device
* @class_dev: driver model's class view of this device.
*
@@ -113,6 +122,7 @@ struct usb_interface {
unsigned num_altsetting; /* number of alternate settings */
int minor; /* minor number this interface is bound to */
+ enum usb_interface_condition condition; /* state of binding */
struct device dev; /* interface specific device info */
struct class_device *class_dev;
};
@@ -341,11 +351,12 @@ extern void usb_put_dev(struct usb_device *dev);
extern void usb_lock_device(struct usb_device *udev);
extern int usb_trylock_device(struct usb_device *udev);
+extern int usb_lock_device_for_reset(struct usb_device *udev,
+ struct usb_interface *iface);
extern void usb_unlock_device(struct usb_device *udev);
-/* mostly for devices emulating SCSI over USB */
+/* USB port reset for device reinitialization */
extern int usb_reset_device(struct usb_device *dev);
-extern int __usb_reset_device(struct usb_device *dev);
extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);