> In the absence of far-reaching changes to the API, my suggestion is to
> have the emulated SCSI bus reset code in usb-storage do nothing but log an
> error message and return an error code.  For the time being, considering
> how infrequently these resets occur, we can simply rely on the user
> unplugging the USB cable and putting it back in or cycling the power to
> the drive.  (Yes, there are situations where these resets crop up
> regularly -- but they are the result of some other incompatibility that a
> device reset won't fix anyway.)

OK, as the consensus seems to be that in the short run changing things
for a full reset implementation is not worth it, here's an implementation
that does the best we can do without.
It issues a reset only if we can be sure that there are no other users
of the device in question.
As the version currently in the storage driver is broken anyway,
this is a definite improvement. And it addresses the need of exporting
the probe/remove functions for storage's sake.

Matt, what do you think?

        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-03-22 17:05:17+01:00, [EMAIL PROTECTED]
  - reduced reset logic restricting usb resets to simple cases


 scsiglue.c |   40 ++++++++++++++--------------------------
 1 files changed, 14 insertions(+), 26 deletions(-)


diff -Nru a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
--- a/drivers/usb/storage/scsiglue.c    Sat Mar 22 17:06:21 2003
+++ b/drivers/usb/storage/scsiglue.c    Sat Mar 22 17:06:21 2003
@@ -231,36 +231,24 @@
        scsi_unlock(srb->device->host);
        us = (struct us_data *)srb->device->host->hostdata[0];
 
-       /* attempt to reset the port */
-       result = usb_reset_device(us->pusb_dev);
-       US_DEBUGP("usb_reset_device returns %d\n", result);
-       if (result < 0) {
-               scsi_lock(srb->device->host);
-               return FAILED;
+       /* The USB subsystem doesn't handle synchronisation between
+          a device's several drivers. Therefore we reset only devices
+          with one interface which we of course own.
+       */
+       
+       //FIXME: needs locking against config changes
+       
+       if ( us->pusb_dev->actconfig->desc.bNumInterfaces == 1) {
+               /* attempt to reset the port */
+               result = usb_reset_device(us->pusb_dev);
+               US_DEBUGP("usb_reset_device returns %d\n", result);
+       } else {
+               result = -EBUSY;
        }
 
-       /* FIXME: This needs to lock out driver probing while it's working
-        * or we can have race conditions */
-       /* This functionality really should be provided by the khubd thread */
-       for (i = 0; i < us->pusb_dev->actconfig->desc.bNumInterfaces; i++) {
-               struct usb_interface *intf =
-                       &us->pusb_dev->actconfig->interface[i];
-
-               /* if this is an unclaimed interface, skip it */
-               if (!intf->driver) {
-                       continue;
-               }
-
-               US_DEBUGP("Examining driver %s...", intf->driver->name);
-
-               /* simulate a disconnect and reconnect for all interfaces */
-               US_DEBUGPX("simulating disconnect/reconnect.\n");
-               usb_device_remove (&intf->dev);
-               usb_device_probe (&intf->dev);
-       }
        US_DEBUGP("bus_reset() complete\n");
        scsi_lock(srb->device->host);
-       return SUCCESS;
+       return result < 0 ? FAILED : SUCCESS;
 }
 
 /***********************************************************************

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


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


begin 664 bkpatch11317
M'XL(`/V)?#X``[U6^V_;-A#^V?PK#BV&INTL\2')EK-D>;8+VFU!/`,;,""0
MJ;-,Q!8-D4H65/O?=Y+S:N"E6_8P!)`F[X[???>=J)<P<5B->G9A+K%B+^$[
MZSS]Q=*6&,SM$A>FK'\+;%70YIFUM!FVR^':(YQ>]'V%Z$+G;25C1E:GF==S
MH$TWZHE`W:WXZQ6.>F?'[R<?]\\8V]F!PWE6%CA&#SL[;'JQE]>X""XJF\W;
M`YN[[49R+H20,5=Q(N)&#I6*&I'P:4[37`[2V31)65%AL;=VUW;YN;OB2DHN
M8BZC)J)1L2,[EMAIL PROTECTED]@)8C#B\4@,WG(QXAS6&>[EMAIL PROTECTED]>[EMAIL 
PROTECTED]'/0A
MT]"'"O-:8TZC(S86MC"ZG?O*:&_*`FHW7>\Y\!:<6:X6"#ISZ-@'B&3*)3N]
MIY/U_^:/,9YQMKLAG0/C/R"NJ-+H=6B*TE;X.#,5Q:[EMAIL PROTECTED]'/!\.!Y$:
M/L7?GX;MRD0<15PV7$1)LA%47K6174BL=+K+"@R==J98U!CH>[EMAIL PROTECTED]:\(0/
MHB89:IZ(-!ZJ6&5<R"?A??F`AT"EB`=I)^A-:6W6]O-Y?2SSIZCD(HU2I9I$
M<BD[Q4OUN=ZC$9?_N][W\YRT?DNR042ATBBTM0GTW?(2<Y.%ER9'&P93[R_[
M9A;8(&\;P,\1;MA=&.>I!SJM_`C]ZJI[2-*G&ZOQC-8XH:[EMAIL PROTECTED]
M6D^;%?)OB/RQ5OZ*KDG50L4#F32Q&@RC3C61?)YJ1`1]F?RW[TDJ_KH!'U7_
MZ5R?H8,CJ2)(V(E4*0C%>N$;^([EMAIL PROTECTED])NT96O/%!V.;VBW76I
MYY4MC<N\L25,T5\AEJP'`!GD>&[EMAIL PROTECTED],01NXPEFK[RN\2=:6B^L;
M#]?Y7QD_IU7JA-)C-<LT&<\-7;3D8F>@;5TYFEV5`>N]"5F/$([EMAIL PROTECTED]
M)6+NB#Y]T5XN69&9TGGR*&>[EMAIL PROTECTED];=/?T=U?$XCD=WM_-M%_;]7=S
M=#J8_E`O3VX!.)(RB-?PB?5:>C)/E*Q\V['K'[EMAIL PROTECTED]
M[PS.U_EM/3SR]3:93L;G1\<'D_>G6R\>&U-H7U>[EMAIL PROTECTED],Z:NOU.^""
M&/[EMAIL PROTECTED])$V+E,9$@:"B=D-O'>LF!GP#'+Z%=_LG'X^/8`3CR>'A
>\7B\??^1H^>H+UR]W)D-,[EMAIL PROTECTED]>U1"0``
`
end



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to