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