How about this one instead?
Introduce unlocked version of usb_set_configuration: __usb_set_configuration.
drivers/usb/core/message.c | 40 -------------------------------------
include/linux/usb.h | 48 ++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 48 insertions(+), 40 deletions(-)
diff -Nru a/drivers/usb/core/message.c b/drivers/usb/core/message.c
--- a/drivers/usb/core/message.c Thu Jan 8 19:54:20 2004
+++ b/drivers/usb/core/message.c Thu Jan 8 19:54:20 2004
@@ -1034,48 +1034,11 @@
return 0;
}
-/**
- * usb_set_configuration - Makes a particular device setting be current
- * @dev: the device whose configuration is being updated
- * @configuration: the configuration being chosen.
- * Context: !in_interrupt ()
- *
- * This is used to enable non-default device modes. Not all devices
- * use this kind of configurability; many devices only have one
- * configuration.
- *
- * USB device configurations may affect Linux interoperability,
- * power consumption and the functionality available. For example,
- * the default configuration is limited to using 100mA of bus power,
- * so that when certain device functionality requires more power,
- * and the device is bus powered, that functionality should be in some
- * non-default device configuration. Other device modes may also be
- * reflected as configuration options, such as whether two ISDN
- * channels are available independently; and choosing between open
- * standard device protocols (like CDC) or proprietary ones.
- *
- * Note that USB has an additional level of device configurability,
- * associated with interfaces. That configurability is accessed using
- * usb_set_interface().
- *
- * This call is synchronous. The calling context must be able to sleep,
- * and must not hold the driver model lock for USB; usb device driver
- * probe() methods may not use this routine.
- *
- * Returns zero on success, or else the status code returned by the
- * underlying call that failed. On succesful completion, each interface
- * in the original device configuration has been destroyed, and each one
- * in the new configuration has been probed by all relevant usb device
- * drivers currently known to the kernel.
- */
-int usb_set_configuration(struct usb_device *dev, int configuration)
+int __usb_set_configuration(struct usb_device *dev, int configuration)
{
int i, ret;
struct usb_host_config *cp = NULL;
- /* dev->serialize guards all config changes */
- down(&dev->serialize);
-
for (i=0; i<dev->descriptor.bNumConfigurations; i++) {
if (dev->config[i].desc.bConfigurationValue == configuration) {
cp = &dev->config[i];
@@ -1148,7 +1111,6 @@
}
out:
- up(&dev->serialize);
return ret;
}
diff -Nru a/include/linux/usb.h b/include/linux/usb.h
--- a/include/linux/usb.h Thu Jan 8 19:54:20 2004
+++ b/include/linux/usb.h Thu Jan 8 19:54:20 2004
@@ -886,8 +886,54 @@
/* wrappers that also update important state inside usbcore */
extern int usb_clear_halt(struct usb_device *dev, int pipe);
extern int usb_reset_configuration(struct usb_device *dev);
-extern int usb_set_configuration(struct usb_device *dev, int configuration);
extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate);
+
+extern int __usb_set_configuration(struct usb_device *dev, int configuration);
+
+/**
+ * usb_set_configuration - Makes a particular device setting be current
+ * @dev: the device whose configuration is being updated
+ * @configuration: the configuration being chosen.
+ * Context: !in_interrupt ()
+ *
+ * This is used to enable non-default device modes. Not all devices
+ * use this kind of configurability; many devices only have one
+ * configuration.
+ *
+ * USB device configurations may affect Linux interoperability,
+ * power consumption and the functionality available. For example,
+ * the default configuration is limited to using 100mA of bus power,
+ * so that when certain device functionality requires more power,
+ * and the device is bus powered, that functionality should be in some
+ * non-default device configuration. Other device modes may also be
+ * reflected as configuration options, such as whether two ISDN
+ * channels are available independently; and choosing between open
+ * standard device protocols (like CDC) or proprietary ones.
+ *
+ * Note that USB has an additional level of device configurability,
+ * associated with interfaces. That configurability is accessed using
+ * usb_set_interface().
+ *
+ * This call is synchronous. The calling context must be able to sleep,
+ * and must not hold the driver model lock for USB; usb device driver
+ * probe() methods may not use this routine.
+ *
+ * Returns zero on success, or else the status code returned by the
+ * underlying call that failed. On succesful completion, each interface
+ * in the original device configuration has been destroyed, and each one
+ * in the new configuration has been probed by all relevant usb device
+ * drivers currently known to the kernel.
+ */
+static inline int usb_set_configuration(struct usb_device *dev, int configuration)
+{
+ int ret;
+
+ /* dev->serialize guards all config changes */
+ down(&dev->serialize);
+ ret = __usb_set_configuration(dev, configuration);
+ up(&dev->serialize);
+ return ret;
+}
/*
* timeouts, in seconds, used for sending/receiving control messages
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel