Commit 5203ad44 authored by Matthew Dharm's avatar Matthew Dharm Committed by Greg Kroah-Hartman

[PATCH] USB Storage: endpoint toggles and reset delays

This patch does two things to help reset recovery.  It started life as
as496 and was rediffed by me.

First, the patch checks the result of a CLEAR_HALT request and doesn't reset the
endpoint's data toggle unless the request succeeded.

Second, it reduces the timeout for a device reset from 20 seconds to 5
seconds.

If all goes well, then I've finally figured quilt out and this patch should
apply cleanly.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarMatthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 01205a0e
...@@ -266,6 +266,7 @@ int usb_stor_clear_halt(struct us_data *us, unsigned int pipe) ...@@ -266,6 +266,7 @@ int usb_stor_clear_halt(struct us_data *us, unsigned int pipe)
NULL, 0, 3*HZ); NULL, 0, 3*HZ);
/* reset the endpoint toggle */ /* reset the endpoint toggle */
if (result >= 0)
usb_settoggle(us->pusb_dev, usb_pipeendpoint(pipe), usb_settoggle(us->pusb_dev, usb_pipeendpoint(pipe),
usb_pipeout(pipe), 0); usb_pipeout(pipe), 0);
...@@ -1124,7 +1125,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -1124,7 +1125,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)
* It's handy that every transport mechanism uses the control endpoint for * It's handy that every transport mechanism uses the control endpoint for
* resets. * resets.
* *
* Basically, we send a reset with a 20-second timeout, so we don't get * Basically, we send a reset with a 5-second timeout, so we don't get
* jammed attempting to do the reset. * jammed attempting to do the reset.
*/ */
static int usb_stor_reset_common(struct us_data *us, static int usb_stor_reset_common(struct us_data *us,
...@@ -1145,13 +1146,9 @@ static int usb_stor_reset_common(struct us_data *us, ...@@ -1145,13 +1146,9 @@ static int usb_stor_reset_common(struct us_data *us,
clear_bit(US_FLIDX_ABORTING, &us->flags); clear_bit(US_FLIDX_ABORTING, &us->flags);
scsi_unlock(us_to_host(us)); scsi_unlock(us_to_host(us));
/* A 20-second timeout may seem rather long, but a LaCie
* StudioDrive USB2 device takes 16+ seconds to get going
* following a powerup or USB attach event.
*/
result = usb_stor_control_msg(us, us->send_ctrl_pipe, result = usb_stor_control_msg(us, us->send_ctrl_pipe,
request, requesttype, value, index, data, size, request, requesttype, value, index, data, size,
20*HZ); 5*HZ);
if (result < 0) { if (result < 0) {
US_DEBUGP("Soft reset failed: %d\n", result); US_DEBUGP("Soft reset failed: %d\n", result);
goto Done; goto Done;
...@@ -1173,8 +1170,10 @@ static int usb_stor_reset_common(struct us_data *us, ...@@ -1173,8 +1170,10 @@ static int usb_stor_reset_common(struct us_data *us,
US_DEBUGP("Soft reset: clearing bulk-out endpoint halt\n"); US_DEBUGP("Soft reset: clearing bulk-out endpoint halt\n");
result2 = usb_stor_clear_halt(us, us->send_bulk_pipe); result2 = usb_stor_clear_halt(us, us->send_bulk_pipe);
/* return a result code based on the result of the control message */ /* return a result code based on the result of the clear-halts */
if (result < 0 || result2 < 0) { if (result >= 0)
result = result2;
if (result < 0) {
US_DEBUGP("Soft reset failed\n"); US_DEBUGP("Soft reset failed\n");
goto Done; goto Done;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment