Commit 5ad22cfc authored by Hans de Goede's avatar Hans de Goede Committed by Greg Kroah-Hartman

uas: Remove support for old sense ui as used in pre-production hardware

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: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent eb7d664a
...@@ -32,20 +32,6 @@ ...@@ -32,20 +32,6 @@
#define MAX_CMNDS 256 #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 uas_dev_info {
struct usb_interface *intf; struct usb_interface *intf;
struct usb_device *udev; struct usb_device *udev;
...@@ -56,7 +42,6 @@ struct uas_dev_info { ...@@ -56,7 +42,6 @@ struct uas_dev_info {
int qdepth, resetting; int qdepth, resetting;
unsigned cmd_pipe, status_pipe, data_in_pipe, data_out_pipe; unsigned cmd_pipe, status_pipe, data_in_pipe, data_out_pipe;
unsigned use_streams:1; unsigned use_streams:1;
unsigned uas_sense_old:1;
unsigned shutdown:1; unsigned shutdown:1;
struct scsi_cmnd *cmnd[MAX_CMNDS]; struct scsi_cmnd *cmnd[MAX_CMNDS];
spinlock_t lock; spinlock_t lock;
...@@ -187,29 +172,6 @@ static void uas_sense(struct urb *urb, struct scsi_cmnd *cmnd) ...@@ -187,29 +172,6 @@ static void uas_sense(struct urb *urb, struct scsi_cmnd *cmnd)
cmnd->result = sense_iu->status; 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, * 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. * 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) ...@@ -339,12 +301,7 @@ static void uas_stat_cmplt(struct urb *urb)
switch (iu->iu_id) { switch (iu->iu_id) {
case IU_ID_STATUS: case IU_ID_STATUS:
if (urb->actual_length < 16) uas_sense(urb, cmnd);
devinfo->uas_sense_old = 1;
if (devinfo->uas_sense_old)
uas_sense_old(urb, cmnd);
else
uas_sense(urb, cmnd);
if (cmnd->result != 0) { if (cmnd->result != 0) {
/* cancel data transfers on error */ /* cancel data transfers on error */
data_in_urb = usb_get_urb(cmdinfo->data_in_urb); data_in_urb = usb_get_urb(cmdinfo->data_in_urb);
...@@ -904,8 +861,6 @@ static int uas_configure_endpoints(struct uas_dev_info *devinfo) ...@@ -904,8 +861,6 @@ static int uas_configure_endpoints(struct uas_dev_info *devinfo)
struct usb_device *udev = devinfo->udev; struct usb_device *udev = devinfo->udev;
int r; int r;
devinfo->uas_sense_old = 0;
r = uas_find_endpoints(devinfo->intf->cur_altsetting, eps); r = uas_find_endpoints(devinfo->intf->cur_altsetting, eps);
if (r) if (r)
return r; return r;
......
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