diff options
-rw-r--r-- | drivers/usb/storage/transport.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 9743e289cd3b..419afb2216b9 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -266,8 +266,9 @@ int usb_stor_clear_halt(struct us_data *us, unsigned int pipe) | |||
266 | NULL, 0, 3*HZ); | 266 | NULL, 0, 3*HZ); |
267 | 267 | ||
268 | /* reset the endpoint toggle */ | 268 | /* reset the endpoint toggle */ |
269 | usb_settoggle(us->pusb_dev, usb_pipeendpoint(pipe), | 269 | if (result >= 0) |
270 | usb_pipeout(pipe), 0); | 270 | usb_settoggle(us->pusb_dev, usb_pipeendpoint(pipe), |
271 | usb_pipeout(pipe), 0); | ||
271 | 272 | ||
272 | US_DEBUGP("%s: result = %d\n", __FUNCTION__, result); | 273 | US_DEBUGP("%s: result = %d\n", __FUNCTION__, result); |
273 | return result; | 274 | return result; |
@@ -1124,7 +1125,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
1124 | * It's handy that every transport mechanism uses the control endpoint for | 1125 | * It's handy that every transport mechanism uses the control endpoint for |
1125 | * resets. | 1126 | * resets. |
1126 | * | 1127 | * |
1127 | * Basically, we send a reset with a 20-second timeout, so we don't get | 1128 | * Basically, we send a reset with a 5-second timeout, so we don't get |
1128 | * jammed attempting to do the reset. | 1129 | * jammed attempting to do the reset. |
1129 | */ | 1130 | */ |
1130 | static int usb_stor_reset_common(struct us_data *us, | 1131 | 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 | clear_bit(US_FLIDX_ABORTING, &us->flags); | 1146 | clear_bit(US_FLIDX_ABORTING, &us->flags); |
1146 | scsi_unlock(us_to_host(us)); | 1147 | scsi_unlock(us_to_host(us)); |
1147 | 1148 | ||
1148 | /* A 20-second timeout may seem rather long, but a LaCie | ||
1149 | * StudioDrive USB2 device takes 16+ seconds to get going | ||
1150 | * following a powerup or USB attach event. | ||
1151 | */ | ||
1152 | result = usb_stor_control_msg(us, us->send_ctrl_pipe, | 1149 | result = usb_stor_control_msg(us, us->send_ctrl_pipe, |
1153 | request, requesttype, value, index, data, size, | 1150 | request, requesttype, value, index, data, size, |
1154 | 20*HZ); | 1151 | 5*HZ); |
1155 | if (result < 0) { | 1152 | if (result < 0) { |
1156 | US_DEBUGP("Soft reset failed: %d\n", result); | 1153 | US_DEBUGP("Soft reset failed: %d\n", result); |
1157 | goto Done; | 1154 | goto Done; |
@@ -1173,8 +1170,10 @@ static int usb_stor_reset_common(struct us_data *us, | |||
1173 | US_DEBUGP("Soft reset: clearing bulk-out endpoint halt\n"); | 1170 | US_DEBUGP("Soft reset: clearing bulk-out endpoint halt\n"); |
1174 | result2 = usb_stor_clear_halt(us, us->send_bulk_pipe); | 1171 | result2 = usb_stor_clear_halt(us, us->send_bulk_pipe); |
1175 | 1172 | ||
1176 | /* return a result code based on the result of the control message */ | 1173 | /* return a result code based on the result of the clear-halts */ |
1177 | if (result < 0 || result2 < 0) { | 1174 | if (result >= 0) |
1175 | result = result2; | ||
1176 | if (result < 0) { | ||
1178 | US_DEBUGP("Soft reset failed\n"); | 1177 | US_DEBUGP("Soft reset failed\n"); |
1179 | goto Done; | 1178 | goto Done; |
1180 | } | 1179 | } |