tree 282cb78a17c0ed2dc403dc7712cda1fc348e2123
parent 9a57116bc9e36c9accc869f666e1d25c5e2cdcbf
author Matthew Dharm <[EMAIL PROTECTED]> Fri, 29 Jul 2005 04:43:08 -0700
committer Greg Kroah-Hartman <[EMAIL PROTECTED]> Fri, 09 Sep 2005 06:22:54 -0700

[PATCH] USB Storage: remove dependency on SCSI-provided serial/tag number

This patch started life as as531 from Alan Stern.  It has been rediffed
against the latest tree.

The SCSI people have deprecated the use of scsi_cmnd.serial_number for
anything other than printk.  Worse than that, the SCSI core doesn't
always increment the number (when the error handler is running, for
example).  So this patch creates a locally-stored value for use in
bulk-only tags.  The net result is a simplification, since we no longer
have to save & restore the serial_number value while autosensing.

Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
Signed-off-by: Matthew Dharm <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

 drivers/usb/storage/transport.c |   10 ++--------
 drivers/usb/storage/usb.h       |    1 +
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -611,7 +611,6 @@ void usb_stor_invoke_transport(struct sc
                unsigned char old_sc_data_direction;
                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");
@@ -648,10 +647,6 @@ void usb_stor_invoke_transport(struct sc
                old_sg = srb->use_sg;
                srb->use_sg = 0;
 
-               /* change the serial number -- toggle the high bit*/
-               old_serial_number = srb->serial_number;
-               srb->serial_number ^= 0x80000000;
-
                /* issue the auto-sense command */
                old_resid = srb->resid;
                srb->resid = 0;
@@ -662,7 +657,6 @@ void usb_stor_invoke_transport(struct sc
                srb->request_buffer = old_request_buffer;
                srb->request_bufflen = old_request_bufflen;
                srb->use_sg = old_sg;
-               srb->serial_number = old_serial_number;
                srb->sc_data_direction = old_sc_data_direction;
                srb->cmd_len = old_cmd_len;
                memcpy(srb->cmnd, old_cmnd, MAX_COMMAND_SIZE);
@@ -985,7 +979,7 @@ int usb_stor_Bulk_transport(struct scsi_
        bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
        bcb->DataTransferLength = cpu_to_le32(transfer_length);
        bcb->Flags = srb->sc_data_direction == DMA_FROM_DEVICE ? 1 << 7 : 0;
-       bcb->Tag = srb->serial_number;
+       bcb->Tag = ++us->tag;
        bcb->Lun = srb->device->lun;
        if (us->flags & US_FL_SCM_MULT_TARG)
                bcb->Lun |= srb->device->id << 4;
@@ -1074,7 +1068,7 @@ int usb_stor_Bulk_transport(struct scsi_
        US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n",
                        le32_to_cpu(bcs->Signature), bcs->Tag, 
                        residue, bcs->Status);
-       if (bcs->Tag != srb->serial_number || bcs->Status > US_BULK_STAT_PHASE) 
{
+       if (bcs->Tag != us->tag || bcs->Status > US_BULK_STAT_PHASE) {
                US_DEBUGP("Bulk logical error\n");
                return USB_STOR_TRANSPORT_ERROR;
        }
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
--- a/drivers/usb/storage/usb.h
+++ b/drivers/usb/storage/usb.h
@@ -158,6 +158,7 @@ struct us_data {
 
        /* SCSI interfaces */
        struct scsi_cmnd        *srb;            /* current srb         */
+       unsigned int            tag;             /* current dCBWTag     */
 
        /* thread information */
        int                     pid;             /* control thread       */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to