Am Dienstag, 14. Oktober 2003 16:56 schrieb Stavros Markou:
> Hi Oliver,
> 
> I send you the usb_physical_reset_device for 2.6.0-test7 kernel. Now the 
> reset works fine and as i 've told you after reset the device gets the 
> same address.
> Hope this will be added to the main kernel tree. ( along with exporting 
> usb_physical_reset_device and prototyping inside usb.h).

Hi,

I've taken another look at the patch I had sent you. Unfortunately
it introduces a race condition. This means that some reorganization
of code is necessary. I am currently working on it.
I am including code that should fix it. It's untested, however.

        Regards
                Oliver

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================


[EMAIL PROTECTED], 2003-10-14 19:10:28+02:00, [EMAIL PROTECTED]
  - fix deadlock for reset during probe


 hcd.c |    6 ++++++
 hub.c |    8 +++++++-
 usb.c |   16 +++++++++++++++-
 3 files changed, 28 insertions(+), 2 deletions(-)


diff -Nru a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
--- a/drivers/usb/core/hcd.c    Tue Oct 14 19:15:31 2003
+++ b/drivers/usb/core/hcd.c    Tue Oct 14 19:15:31 2003
@@ -750,6 +750,12 @@
        usb_dev->bus->devnum_next = devnum + 1;
        set_bit (devnum, usb_dev->bus->devmap.devicemap);
 
+       retval = usb_init_device (usb_dev, parent_dev);
+       if (retval) {
+               dev_err (parent_dev, "can't register root hub for %s, %d\n",
+                               usb_dev->dev.bus_id, retval);
+               return retval;
+       }
        retval = usb_new_device (usb_dev, parent_dev);
        if (retval)
                dev_err (parent_dev, "can't register root hub for %s, %d\n",
diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c    Tue Oct 14 19:15:31 2003
+++ b/drivers/usb/core/hub.c    Tue Oct 14 19:15:31 2003
@@ -977,16 +977,22 @@
                 * is the "bus_id"; hubs show in hierarchy like bridges
                 */
                dev->dev.parent = dev->parent->dev.parent->parent;
+               
+               if (usb_init_device(dev, &hub->dev) < 0)
+                       break;
 
+               /* drop the lock so drivers can reset*/
+               up(&usb_address0_sem);
                /* Run it through the hoops (find a driver, etc) */
                if (!usb_new_device(dev, &hub->dev))
-                       goto done;
+                       return;
 
                /* Free the configuration if there was an error */
                usb_put_dev(dev);
 
                /* Switch to a long reset time */
                delay = HUB_LONG_RESET_TIME;
+               down(&usb_address0_sem);
        }
 
        hub->children[port] = NULL;
diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c    Tue Oct 14 19:15:31 2003
+++ b/drivers/usb/core/usb.c    Tue Oct 14 19:15:31 2003
@@ -986,7 +986,8 @@
  */
 #define NEW_DEVICE_RETRYS      2
 #define SET_ADDRESS_RETRYS     2
-int usb_new_device(struct usb_device *dev, struct device *parent)
+
+int usb_init_device(struct usb_device *dev, struct device *parent)
 {
        int err = -EINVAL;
        int i;
@@ -1094,7 +1095,20 @@
        if (dev->descriptor.iSerialNumber)
                usb_show_string(dev, "SerialNumber", dev->descriptor.iSerialNumber);
 #endif
+       return 0;
+fail:
+       dev->state = USB_STATE_DEFAULT;
+       clear_bit(dev->devnum, dev->bus->devmap.devicemap);
+       dev->devnum = -1;
+       return err;
+}
 
+int usb_new_device(struct usb_device *dev, struct device *parent)
+{
+       int err;
+       int i;
+       int j;
+       
        /* put device-specific files into sysfs */
        err = device_add (&dev->dev);
        if (err) {

===================================================================


This BitKeeper patch contains the following changesets:
1.2521
## Wrapped with gzip_uu ##


begin 664 bkpatch2701
M'XL(`#,OC#\``ZU7:5/;2!#][/D574DE`8+M.768A0("NYLB54MQ?$N5:R0-
MMH(MN73`9J/\]VV-?"TK8/'BLC7CT4S/F^[7KZ6W<)V;;-!))_&=R<A;^#W-
MBT$'^],R,DDO,>5M.>VEV0CO7:0IWNN/TZGI-POZ5YDQ>;_,@R[O*8)SSG41
[EMAIL PROTECTED],.ZXGE2/%]9@:=B]/?KK\<71"ROP^?QCH9F4M3P/X^"6X/H]),>K=9
MJL?U=M7R=L4I98QQ185RF*JX)X2LF$.#"+L1=_V;P/$)KDS2_-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ED];N?>E1_M!.K41:]?VXGG[#=M'E+:NNC7A7[/N/R^VRUI/
M?:SW2C96Q%)LQ4:<=U[WH5E'>E;4)1,CLO!U3;Q88^'419PFR/_F">59H:T/
MO(G0NHHC-6K&W.D)\N<!^1OIM9QH2%#W:];5JMPLVH8?M0R:NR'R`K96TW;A
M#6KLAP)5=H0/[EMAIL PROTECTED]"O`=#%"U[1O"NWP7WD5?DS>[M:YVYOM8*O>0[,,XVH7Y
[EMAIL PROTECTED]/-"`[\7+VPA6,3WN;E=-\7*F2!,N1OW[7P4QH.````
`
end



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to