Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264936
b: refs/heads/master
c: e16da02
h: refs/heads/master
v: v3
  • Loading branch information
Luben Tuikov authored and Greg Kroah-Hartman committed Sep 9, 2011
1 parent 77f0046 commit 9c3aa83
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 73ddc2474bcc5234fa0a4e406e015ed16d16b6c8
refs/heads/master: e16da02fcdf1c5e824432f88abf42623dafdf191
34 changes: 19 additions & 15 deletions trunk/drivers/usb/storage/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,9 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
int temp_result;
struct scsi_eh_save ses;
int sense_size = US_SENSE_SIZE;
struct scsi_sense_hdr sshdr;
const u8 *scdd;
u8 fm_ili;

/* device supports and needs bigger sense buffer */
if (us->fflags & US_FL_SANE_SENSE)
Expand Down Expand Up @@ -774,32 +777,30 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
srb->sense_buffer[7] = (US_SENSE_SIZE - 8);
}

scsi_normalize_sense(srb->sense_buffer, SCSI_SENSE_BUFFERSIZE,
&sshdr);

US_DEBUGP("-- Result from auto-sense is %d\n", temp_result);
US_DEBUGP("-- code: 0x%x, key: 0x%x, ASC: 0x%x, ASCQ: 0x%x\n",
srb->sense_buffer[0],
srb->sense_buffer[2] & 0xf,
srb->sense_buffer[12],
srb->sense_buffer[13]);
sshdr.response_code, sshdr.sense_key,
sshdr.asc, sshdr.ascq);
#ifdef CONFIG_USB_STORAGE_DEBUG
usb_stor_show_sense(
srb->sense_buffer[2] & 0xf,
srb->sense_buffer[12],
srb->sense_buffer[13]);
usb_stor_show_sense(sshdr.sense_key, sshdr.asc, sshdr.ascq);
#endif

/* set the result so the higher layers expect this data */
srb->result = SAM_STAT_CHECK_CONDITION;

scdd = scsi_sense_desc_find(srb->sense_buffer,
SCSI_SENSE_BUFFERSIZE, 4);
fm_ili = (scdd ? scdd[3] : srb->sense_buffer[2]) & 0xA0;

/* We often get empty sense data. This could indicate that
* everything worked or that there was an unspecified
* problem. We have to decide which.
*/
if ( /* Filemark 0, ignore EOM, ILI 0, no sense */
(srb->sense_buffer[2] & 0xaf) == 0 &&
/* No ASC or ASCQ */
srb->sense_buffer[12] == 0 &&
srb->sense_buffer[13] == 0) {

if (sshdr.sense_key == 0 && sshdr.asc == 0 && sshdr.ascq == 0 &&
fm_ili == 0) {
/* If things are really okay, then let's show that.
* Zero out the sense buffer so the higher layers
* won't realize we did an unsolicited auto-sense.
Expand All @@ -814,7 +815,10 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
*/
} else {
srb->result = DID_ERROR << 16;
srb->sense_buffer[2] = HARDWARE_ERROR;
if ((sshdr.response_code & 0x72) == 0x72)
srb->sense_buffer[1] = HARDWARE_ERROR;
else
srb->sense_buffer[2] = HARDWARE_ERROR;
}
}
}
Expand Down

0 comments on commit 9c3aa83

Please sign in to comment.