diff options
author | Hans de Goede <hdegoede@redhat.com> | 2014-09-13 06:26:47 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-24 00:42:12 -0400 |
commit | 5ad22cfc13399cc46267e5685769d6e7a0bbe163 (patch) | |
tree | aea4329ab2832043102cde477d59807355c743d2 /drivers/usb/storage | |
parent | eb7d664ae459114cbbee8ecef17f90b9c71d994c (diff) |
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: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r-- | drivers/usb/storage/uas.c | 47 |
1 files changed, 1 insertions, 46 deletions
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 4455fab398ec..720310ab3bf3 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c | |||
@@ -32,20 +32,6 @@ | |||
32 | 32 | ||
33 | #define MAX_CMNDS 256 | 33 | #define MAX_CMNDS 256 |
34 | 34 | ||
35 | /* | ||
36 | * The r00-r01c specs define this version of the SENSE IU data structure. | ||
37 | * It's still in use by several different firmware releases. | ||
38 | */ | ||
39 | struct sense_iu_old { | ||
40 | __u8 iu_id; | ||
41 | __u8 rsvd1; | ||
42 | __be16 tag; | ||
43 | __be16 len; | ||
44 | __u8 status; | ||
45 | __u8 service_response; | ||
46 | __u8 sense[SCSI_SENSE_BUFFERSIZE]; | ||
47 | }; | ||
48 | |||
49 | struct uas_dev_info { | 35 | struct uas_dev_info { |
50 | struct usb_interface *intf; | 36 | struct usb_interface *intf; |
51 | struct usb_device *udev; | 37 | struct usb_device *udev; |
@@ -56,7 +42,6 @@ struct uas_dev_info { | |||
56 | int qdepth, resetting; | 42 | int qdepth, resetting; |
57 | unsigned cmd_pipe, status_pipe, data_in_pipe, data_out_pipe; | 43 | unsigned cmd_pipe, status_pipe, data_in_pipe, data_out_pipe; |
58 | unsigned use_streams:1; | 44 | unsigned use_streams:1; |
59 | unsigned uas_sense_old:1; | ||
60 | unsigned shutdown:1; | 45 | unsigned shutdown:1; |
61 | struct scsi_cmnd *cmnd[MAX_CMNDS]; | 46 | struct scsi_cmnd *cmnd[MAX_CMNDS]; |
62 | spinlock_t lock; | 47 | spinlock_t lock; |
@@ -187,29 +172,6 @@ static void uas_sense(struct urb *urb, struct scsi_cmnd *cmnd) | |||
187 | cmnd->result = sense_iu->status; | 172 | cmnd->result = sense_iu->status; |
188 | } | 173 | } |
189 | 174 | ||
190 | static void uas_sense_old(struct urb *urb, struct scsi_cmnd *cmnd) | ||
191 | { | ||
192 | struct sense_iu_old *sense_iu = urb->transfer_buffer; | ||
193 | struct scsi_device *sdev = cmnd->device; | ||
194 | |||
195 | if (urb->actual_length > 8) { | ||
196 | unsigned len = be16_to_cpup(&sense_iu->len) - 2; | ||
197 | if (len + 8 != urb->actual_length) { | ||
198 | int newlen = min(len + 8, urb->actual_length) - 8; | ||
199 | if (newlen < 0) | ||
200 | newlen = 0; | ||
201 | sdev_printk(KERN_INFO, sdev, "%s: urb length %d " | ||
202 | "disagrees with IU sense data length %d, " | ||
203 | "using %d bytes of sense data\n", __func__, | ||
204 | urb->actual_length, len, newlen); | ||
205 | len = newlen; | ||
206 | } | ||
207 | memcpy(cmnd->sense_buffer, sense_iu->sense, len); | ||
208 | } | ||
209 | |||
210 | cmnd->result = sense_iu->status; | ||
211 | } | ||
212 | |||
213 | /* | 175 | /* |
214 | * scsi-tags go from 0 - (nr_tags - 1), uas tags need to match stream-ids, | 176 | * scsi-tags go from 0 - (nr_tags - 1), uas tags need to match stream-ids, |
215 | * which go from 1 - nr_streams. And we use 1 for untagged commands. | 177 | * 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 | 301 | ||
340 | switch (iu->iu_id) { | 302 | switch (iu->iu_id) { |
341 | case IU_ID_STATUS: | 303 | case IU_ID_STATUS: |
342 | if (urb->actual_length < 16) | 304 | uas_sense(urb, cmnd); |
343 | devinfo->uas_sense_old = 1; | ||
344 | if (devinfo->uas_sense_old) | ||
345 | uas_sense_old(urb, cmnd); | ||
346 | else | ||
347 | uas_sense(urb, cmnd); | ||
348 | if (cmnd->result != 0) { | 305 | if (cmnd->result != 0) { |
349 | /* cancel data transfers on error */ | 306 | /* cancel data transfers on error */ |
350 | data_in_urb = usb_get_urb(cmdinfo->data_in_urb); | 307 | 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 | struct usb_device *udev = devinfo->udev; | 861 | struct usb_device *udev = devinfo->udev; |
905 | int r; | 862 | int r; |
906 | 863 | ||
907 | devinfo->uas_sense_old = 0; | ||
908 | |||
909 | r = uas_find_endpoints(devinfo->intf->cur_altsetting, eps); | 864 | r = uas_find_endpoints(devinfo->intf->cur_altsetting, eps); |
910 | if (r) | 865 | if (r) |
911 | return r; | 866 | return r; |