ChangeSet 1.1557.49.13, 2004/02/17 16:44:43-08:00, mdharm-usb@one-eyed-alien.net

[PATCH] USB Storage: Save the SCSI residue value when auto-sensing

This patch (a regeneration of as173) saves the residue value of a command
when doing an auto-sense.

Not that it really matters much -- almost nobody looks at that value.  But
it's definately incorrect the way it is, and this fixes it.


 drivers/usb/storage/transport.c |    4 ++++
 1 files changed, 4 insertions(+)


diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c	Thu Feb 19 17:22:02 2004
+++ b/drivers/usb/storage/transport.c	Thu Feb 19 17:22:02 2004
@@ -605,6 +605,7 @@
 		unsigned char old_cmd_len;
 		unsigned char old_cmnd[MAX_COMMAND_SIZE];
 		unsigned long old_serial_number;
+		int old_resid;
 
 		US_DEBUGP("Issuing auto-REQUEST_SENSE\n");
 
@@ -645,9 +646,12 @@
 		srb->serial_number ^= 0x80000000;
 
 		/* issue the auto-sense command */
+		old_resid = srb->resid;
+		srb->resid = 0;
 		temp_result = us->transport(us->srb, us);
 
 		/* let's clean up right away */
+		srb->resid = old_resid;
 		srb->request_buffer = old_request_buffer;
 		srb->request_bufflen = old_request_bufflen;
 		srb->use_sg = old_sg;
