Commit ad05da65 authored by Matthew Dharm's avatar Matthew Dharm Committed by Greg Kroah-Hartman

[PATCH] USB: usb-storage: change result codes

This patch changes to SAM_STAT_ result codes, which is (a) preferred,
according to the code comments, and (b) removes some odd-looking
bit-shifting.
parent ac01ad71
......@@ -670,7 +670,7 @@ int datafab_transport(Scsi_Cmnd * srb, struct us_data *us)
srb->result = SUCCESS;
} else {
info->sense_key = UNIT_ATTENTION;
srb->result = CHECK_CONDITION << 1;
srb->result = SAM_STAT_CHECK_CONDITION;
}
return rc;
}
......
......@@ -558,7 +558,7 @@ void isd200_invoke_transport( struct us_data *us,
case USB_STOR_TRANSPORT_GOOD:
/* Indicate a good result */
srb->result = GOOD << 1;
srb->result = SAM_STAT_GOOD;
break;
case USB_STOR_TRANSPORT_FAILED:
......@@ -598,11 +598,11 @@ void isd200_invoke_transport( struct us_data *us,
}
if (result == ISD200_GOOD) {
isd200_build_sense(us, srb);
srb->result = CHECK_CONDITION << 1;
srb->result = SAM_STAT_CHECK_CONDITION;
/* If things are really okay, then let's show that */
if ((srb->sense_buffer[2] & 0xf) == 0x0)
srb->result = GOOD << 1;
srb->result = SAM_STAT_GOOD;
} else
srb->result = DID_ERROR << 16;
}
......@@ -611,7 +611,7 @@ void isd200_invoke_transport( struct us_data *us,
* condition, show that in the result code
*/
if (transferStatus == USB_STOR_TRANSPORT_FAILED)
srb->result = CHECK_CONDITION << 1;
srb->result = SAM_STAT_CHECK_CONDITION;
}
#ifdef CONFIG_USB_STORAGE_DEBUG
......@@ -1185,7 +1185,7 @@ int isd200_scsi_to_ata(Scsi_Cmnd *srb, struct us_data *us,
/* copy InquiryData */
isd200_data_copy(srb, (char *) &info->InquiryData, srb->request_bufflen);
srb->result = GOOD << 1;
srb->result = SAM_STAT_GOOD;
sendToTransport = FALSE;
break;
......@@ -1205,7 +1205,7 @@ int isd200_scsi_to_ata(Scsi_Cmnd *srb, struct us_data *us,
srb->request_bufflen = 0;
} else {
US_DEBUGP(" Media Status not supported, just report okay\n");
srb->result = GOOD << 1;
srb->result = SAM_STAT_GOOD;
sendToTransport = FALSE;
}
break;
......@@ -1226,7 +1226,7 @@ int isd200_scsi_to_ata(Scsi_Cmnd *srb, struct us_data *us,
srb->request_bufflen = 0;
} else {
US_DEBUGP(" Media Status not supported, just report okay\n");
srb->result = GOOD << 1;
srb->result = SAM_STAT_GOOD;
sendToTransport = FALSE;
}
break;
......@@ -1252,7 +1252,7 @@ int isd200_scsi_to_ata(Scsi_Cmnd *srb, struct us_data *us,
srb->request_bufflen = sizeof(struct read_capacity_data);
isd200_data_copy(srb, (char *) &readCapacityData, srb->request_bufflen);
srb->result = GOOD << 1;
srb->result = SAM_STAT_GOOD;
sendToTransport = FALSE;
}
break;
......@@ -1336,7 +1336,7 @@ int isd200_scsi_to_ata(Scsi_Cmnd *srb, struct us_data *us,
srb->request_bufflen = 0;
} else {
US_DEBUGP(" Not removeable media, just report okay\n");
srb->result = GOOD << 1;
srb->result = SAM_STAT_GOOD;
sendToTransport = FALSE;
}
break;
......@@ -1365,7 +1365,7 @@ int isd200_scsi_to_ata(Scsi_Cmnd *srb, struct us_data *us,
srb->request_bufflen = 0;
} else {
US_DEBUGP(" Nothing to do, just report okay\n");
srb->result = GOOD << 1;
srb->result = SAM_STAT_GOOD;
sendToTransport = FALSE;
}
break;
......
......@@ -611,7 +611,7 @@ int jumpshot_transport(Scsi_Cmnd * srb, struct us_data *us)
srb->result = SUCCESS;
} else {
info->sense_key = UNIT_ATTENTION;
srb->result = CHECK_CONDITION << 1;
srb->result = SAM_STAT_CHECK_CONDITION;
}
return rc;
}
......
......@@ -137,8 +137,7 @@ void usb_stor_qic157_command(Scsi_Cmnd *srb, struct us_data *us)
/* send the command to the transport layer */
usb_stor_invoke_transport(srb, us);
if (srb->result == GOOD << 1) {
if (srb->result == SAM_STAT_GOOD) {
/* fix the INQUIRY data if necessary */
fix_inquiry_data(srb);
}
......@@ -210,7 +209,7 @@ void usb_stor_ATAPI_command(Scsi_Cmnd *srb, struct us_data *us)
/* send the command to the transport layer */
usb_stor_invoke_transport(srb, us);
if (srb->result == GOOD << 1) {
if (srb->result == SAM_STAT_GOOD) {
/* Fix the MODE_SENSE data if we translated the command */
if (old_cmnd == MODE_SENSE)
......@@ -307,7 +306,7 @@ void usb_stor_ufi_command(Scsi_Cmnd *srb, struct us_data *us)
/* send the command to the transport layer */
usb_stor_invoke_transport(srb, us);
if (srb->result == GOOD << 1) {
if (srb->result == SAM_STAT_GOOD) {
/* Fix the MODE_SENSE data if we translated the command */
if (old_cmnd == MODE_SENSE)
......@@ -376,7 +375,7 @@ void usb_stor_transparent_scsi_command(Scsi_Cmnd *srb, struct us_data *us)
/* send the command to the transport layer */
usb_stor_invoke_transport(srb, us);
if (srb->result == GOOD << 1) {
if (srb->result == SAM_STAT_GOOD) {
/* Fix the MODE_SENSE data if we translated the command */
if ((us->flags & US_FL_MODE_XLATE) && (old_cmnd == MODE_SENSE))
......
......@@ -669,19 +669,19 @@ void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us)
#endif
/* set the result so the higher layers expect this data */
srb->result = CHECK_CONDITION << 1;
srb->result = SAM_STAT_CHECK_CONDITION;
/* If things are really okay, then let's show that */
if ((srb->sense_buffer[2] & 0xf) == 0x0)
srb->result = GOOD << 1;
srb->result = SAM_STAT_GOOD;
} else /* if (need_auto_sense) */
srb->result = GOOD << 1;
srb->result = SAM_STAT_GOOD;
/* Regardless of auto-sense, if we _know_ we have an error
* condition, show that in the result code
*/
if (result == USB_STOR_TRANSPORT_FAILED)
srb->result = CHECK_CONDITION << 1;
srb->result = SAM_STAT_CHECK_CONDITION;
/* If we think we're good, then make sure the sense data shows it.
* This is necessary because the auto-sense for some devices always
......
......@@ -374,7 +374,7 @@ static int usb_stor_control_thread(void * __us)
memcpy(us->srb->sense_buffer,
usb_stor_sense_invalidCDB,
sizeof(usb_stor_sense_invalidCDB));
us->srb->result = CHECK_CONDITION << 1;
us->srb->result = SAM_STAT_CHECK_CONDITION;
}
/* Handle those devices which need us to fake
......@@ -387,7 +387,7 @@ static int usb_stor_control_thread(void * __us)
US_DEBUGP("Faking INQUIRY command\n");
fill_inquiry_response(us, data_ptr, 36);
us->srb->result = GOOD << 1;
us->srb->result = SAM_STAT_GOOD;
}
/* we've got a command, let's do it! */
......
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