]> git.karo-electronics.de Git - linux-beck.git/commitdiff
uas: Remove support for old sense ui as used in pre-production hardware
authorHans de Goede <hdegoede@redhat.com>
Sat, 13 Sep 2014 10:26:47 +0000 (12:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Sep 2014 04:42:12 +0000 (21:42 -0700)
I've access to a number of different uas devices now, and none of them use
old style sense urbs. The only case where these code-paths trigger is with
the asm1051 and there they do the wrong thing, as the asm1051 sends 8 bytes
status iu-s when it does not have any sense data, but uses new style
sense iu-s regardless, as can be seen for scsi cmnds where there is sense
data.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/storage/uas.c

index 4455fab398ec1d12c0cc328880d3fa6463595a64..720310ab3bf339c0a46e6a807d4519df9b85f018 100644 (file)
 
 #define MAX_CMNDS 256
 
-/*
- * The r00-r01c specs define this version of the SENSE IU data structure.
- * It's still in use by several different firmware releases.
- */
-struct sense_iu_old {
-       __u8 iu_id;
-       __u8 rsvd1;
-       __be16 tag;
-       __be16 len;
-       __u8 status;
-       __u8 service_response;
-       __u8 sense[SCSI_SENSE_BUFFERSIZE];
-};
-
 struct uas_dev_info {
        struct usb_interface *intf;
        struct usb_device *udev;
@@ -56,7 +42,6 @@ struct uas_dev_info {
        int qdepth, resetting;
        unsigned cmd_pipe, status_pipe, data_in_pipe, data_out_pipe;
        unsigned use_streams:1;
-       unsigned uas_sense_old:1;
        unsigned shutdown:1;
        struct scsi_cmnd *cmnd[MAX_CMNDS];
        spinlock_t lock;
@@ -187,29 +172,6 @@ static void uas_sense(struct urb *urb, struct scsi_cmnd *cmnd)
        cmnd->result = sense_iu->status;
 }
 
-static void uas_sense_old(struct urb *urb, struct scsi_cmnd *cmnd)
-{
-       struct sense_iu_old *sense_iu = urb->transfer_buffer;
-       struct scsi_device *sdev = cmnd->device;
-
-       if (urb->actual_length > 8) {
-               unsigned len = be16_to_cpup(&sense_iu->len) - 2;
-               if (len + 8 != urb->actual_length) {
-                       int newlen = min(len + 8, urb->actual_length) - 8;
-                       if (newlen < 0)
-                               newlen = 0;
-                       sdev_printk(KERN_INFO, sdev, "%s: urb length %d "
-                               "disagrees with IU sense data length %d, "
-                               "using %d bytes of sense data\n", __func__,
-                                       urb->actual_length, len, newlen);
-                       len = newlen;
-               }
-               memcpy(cmnd->sense_buffer, sense_iu->sense, len);
-       }
-
-       cmnd->result = sense_iu->status;
-}
-
 /*
  * scsi-tags go from 0 - (nr_tags - 1), uas tags need to match stream-ids,
  * which go from 1 - nr_streams. And we use 1 for untagged commands.
@@ -339,12 +301,7 @@ static void uas_stat_cmplt(struct urb *urb)
 
        switch (iu->iu_id) {
        case IU_ID_STATUS:
-               if (urb->actual_length < 16)
-                       devinfo->uas_sense_old = 1;
-               if (devinfo->uas_sense_old)
-                       uas_sense_old(urb, cmnd);
-               else
-                       uas_sense(urb, cmnd);
+               uas_sense(urb, cmnd);
                if (cmnd->result != 0) {
                        /* cancel data transfers on error */
                        data_in_urb = usb_get_urb(cmdinfo->data_in_urb);
@@ -904,8 +861,6 @@ static int uas_configure_endpoints(struct uas_dev_info *devinfo)
        struct usb_device *udev = devinfo->udev;
        int r;
 
-       devinfo->uas_sense_old = 0;
-
        r = uas_find_endpoints(devinfo->intf->cur_altsetting, eps);
        if (r)
                return r;