The core/message.c file is getting kind of large and unfocussed.  Maybe it 
should be re-factored (so to speak) at some point.  Not important for now.


On Wed, 13 Aug 2003, David Brownell wrote:

> This patch is an update of one I sent around with 2.5.70, when the
> kernel wasn't quite ready to do this.  It resolves some bugs in the
> way changing device configurations were reflected in the driver model:

>   - Makes the bConfigurationValue be writable through sysfs, so
>     device configurations can be easily changed from user mode.

I foresee races between set_bConfigurationValue() and disconnect.  But 
that's not something I can fix in two minutes.

Some minor changes below, but otherwise this looks good.

Alan Stern


--- 2.6.0/drivers/usb/core/message.c.2  Thu Aug 14 10:04:41 2003
+++ 2.6.0/drivers/usb/core/message.c    Thu Aug 14 10:08:30 2003
@@ -1064,7 +1064,7 @@
  *
  * 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 destroied, and each one
+ * 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.
  */
@@ -1095,13 +1095,15 @@
 
        if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
                        USB_REQ_SET_CONFIGURATION, 0, configuration, 0,
-                       NULL, 0, HZ * USB_CTRL_SET_TIMEOUT)) < 0) {
-               up(&dev->serialize);
-               return ret;
-       }
-       if (configuration)
-               dev->state = USB_STATE_CONFIGURED;
+                       NULL, 0, HZ * USB_CTRL_SET_TIMEOUT)) < 0)
+               goto out;
+
        dev->actconfig = cp;
+       if (!configuration) {
+               dev->state = USB_STATE_ADDRESS;
+               goto out;
+       }
+       dev->state = USB_STATE_CONFIGURED;
 
        /* re-initialize hc/hcd/usbcore interface/endpoint state.
         * this triggers binding of drivers to interfaces; and
@@ -1128,8 +1130,9 @@
                usb_create_driverfs_intf_files (intf);
        }
 
+out:
        up(&dev->serialize);
-       return 0;
+       return ret;
 }
 
 




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to