All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>,
	"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>
Cc: linux-scsi@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Bart Van Assche <bvanassche@acm.org>,
	Don Brace <don.brace@microchip.com>,
	Alan Stern <stern@rowland.harvard.edu>
Subject: [PATCH 103/117] usb: Convert to the scsi_status union
Date: Mon, 19 Apr 2021 19:13:48 -0700	[thread overview]
Message-ID: <20210420021402.27678-13-bvanassche@acm.org> (raw)
In-Reply-To: <20210420000845.25873-1-bvanassche@acm.org>

An explanation of the purpose of this patch is available in the patch
"scsi: Introduce the scsi_status union".

Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/usb/image/microtek.c        |  4 ++--
 drivers/usb/storage/cypress_atacb.c | 12 +++++-----
 drivers/usb/storage/datafab.c       |  4 ++--
 drivers/usb/storage/isd200.c        | 34 ++++++++++++++---------------
 drivers/usb/storage/jumpshot.c      |  4 ++--
 drivers/usb/storage/realtek_cr.c    | 10 ++++-----
 drivers/usb/storage/scsiglue.c      |  4 ++--
 drivers/usb/storage/transport.c     | 30 ++++++++++++-------------
 drivers/usb/storage/uas.c           |  8 +++----
 drivers/usb/storage/usb.c           | 14 ++++++------
 10 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index 59b02a539963..1e864ad1da8e 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -408,8 +408,8 @@ static void mts_transfer_done( struct urb *transfer )
 {
 	MTS_INT_INIT();
 
-	context->srb->result &= MTS_SCSI_ERR_MASK;
-	context->srb->result |= (unsigned)(*context->scsi_status)<<1;
+	context->srb->status.combined &= MTS_SCSI_ERR_MASK;
+	context->srb->status.combined |= (unsigned)(*context->scsi_status)<<1;
 
 	mts_transfer_cleanup(transfer);
 }
diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c
index a6f3267bbef6..1d0449443759 100644
--- a/drivers/usb/storage/cypress_atacb.c
+++ b/drivers/usb/storage/cypress_atacb.c
@@ -148,7 +148,7 @@ static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
 	usb_stor_transparent_scsi_command(srb, us);
 
 	/* if the device doesn't support ATACB */
-	if (srb->result == SAM_STAT_CHECK_CONDITION &&
+	if (srb->status.combined == SAM_STAT_CHECK_CONDITION &&
 			memcmp(srb->sense_buffer, usb_stor_sense_invalidCDB,
 				sizeof(usb_stor_sense_invalidCDB)) == 0) {
 		usb_stor_dbg(us, "cypress atacb not supported ???\n");
@@ -159,8 +159,8 @@ static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
 	 * if ck_cond flags is set, and there wasn't critical error,
 	 * build the special sense
 	 */
-	if ((srb->result != (DID_ERROR << 16) &&
-				srb->result != (DID_ABORT << 16)) &&
+	if ((srb->status.combined != (DID_ERROR << 16) &&
+				srb->status.combined != (DID_ABORT << 16)) &&
 			save_cmnd[2] & 0x20) {
 		struct scsi_eh_save ses;
 		unsigned char regs[8];
@@ -182,7 +182,7 @@ static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
 
 		usb_stor_transparent_scsi_command(srb, us);
 		memcpy(regs, srb->sense_buffer, sizeof(regs));
-		tmp_result = srb->result;
+		tmp_result = srb->status.combined;
 		scsi_eh_restore_cmnd(srb, &ses);
 		/* we fail to get registers, report invalid command */
 		if (tmp_result != SAM_STAT_GOOD)
@@ -221,11 +221,11 @@ static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
 		desc[12] = regs[6];  /* device */
 		desc[13] = regs[7];  /* command */
 
-		srb->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
+		srb->status.combined = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
 	}
 	goto end;
 invalid_fld:
-	srb->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
+	srb->status.combined = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
 
 	memcpy(srb->sense_buffer,
 			usb_stor_sense_invalidCDB,
diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c
index 588818483f4b..fc3c0305cad3 100644
--- a/drivers/usb/storage/datafab.c
+++ b/drivers/usb/storage/datafab.c
@@ -702,10 +702,10 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us)
 		rc = datafab_id_device(us, info);
 		if (rc == USB_STOR_TRANSPORT_GOOD) {
 			info->sense_key = NO_SENSE;
-			srb->result = SUCCESS;
+			srb->status.combined = SUCCESS;
 		} else {
 			info->sense_key = UNIT_ATTENTION;
-			srb->result = SAM_STAT_CHECK_CONDITION;
+			srb->status.combined = SAM_STAT_CHECK_CONDITION;
 		}
 		return rc;
 	}
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index 3c76336e43bb..11b1ad6fa5f0 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -630,12 +630,12 @@ static void isd200_invoke_transport( struct us_data *us,
 
 	case USB_STOR_TRANSPORT_GOOD:
 		/* Indicate a good result */
-		srb->result = SAM_STAT_GOOD;
+		srb->status.combined = SAM_STAT_GOOD;
 		break;
 
 	case USB_STOR_TRANSPORT_NO_SENSE:
 		usb_stor_dbg(us, "-- transport indicates protocol failure\n");
-		srb->result = SAM_STAT_CHECK_CONDITION;
+		srb->status.combined = SAM_STAT_CHECK_CONDITION;
 		return;
 
 	case USB_STOR_TRANSPORT_FAILED:
@@ -645,13 +645,13 @@ static void isd200_invoke_transport( struct us_data *us,
 
 	case USB_STOR_TRANSPORT_ERROR:
 		usb_stor_dbg(us, "-- transport indicates transport error\n");
-		srb->result = DID_ERROR << 16;
+		srb->status.combined = DID_ERROR << 16;
 		/* Need reset here */
 		return;
     
 	default:
 		usb_stor_dbg(us, "-- transport indicates unknown error\n");
-		srb->result = DID_ERROR << 16;
+		srb->status.combined = DID_ERROR << 16;
 		/* Need reset here */
 		return;
 	}
@@ -674,13 +674,13 @@ static void isd200_invoke_transport( struct us_data *us,
 		}
 		if (result == ISD200_GOOD) {
 			isd200_build_sense(us, srb);
-			srb->result = SAM_STAT_CHECK_CONDITION;
+			srb->status.combined = SAM_STAT_CHECK_CONDITION;
 
 			/* If things are really okay, then let's show that */
 			if ((srb->sense_buffer[2] & 0xf) == 0x0)
-				srb->result = SAM_STAT_GOOD;
+				srb->status.combined = SAM_STAT_GOOD;
 		} else {
-			srb->result = DID_ERROR << 16;
+			srb->status.combined = DID_ERROR << 16;
 			/* Need reset here */
 		}
 	}
@@ -690,7 +690,7 @@ static void isd200_invoke_transport( struct us_data *us,
 	 * condition, show that in the result code
 	 */
 	if (transferStatus == USB_STOR_TRANSPORT_FAILED)
-		srb->result = SAM_STAT_CHECK_CONDITION;
+		srb->status.combined = SAM_STAT_CHECK_CONDITION;
 	return;
 
 	/*
@@ -698,7 +698,7 @@ static void isd200_invoke_transport( struct us_data *us,
 	 * following an abort
 	 */
 	Handle_Abort:
-	srb->result = DID_ABORT << 16;
+	srb->status.combined = DID_ABORT << 16;
 
 	/* permit the reset transfer to take place */
 	clear_bit(US_FLIDX_ABORTING, &us->dflags);
@@ -1238,7 +1238,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
 		/* copy InquiryData */
 		usb_stor_set_xfer_buf((unsigned char *) &info->InquiryData,
 				sizeof(info->InquiryData), srb);
-		srb->result = SAM_STAT_GOOD;
+		srb->status.combined = SAM_STAT_GOOD;
 		sendToTransport = 0;
 		break;
 
@@ -1258,7 +1258,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
 			isd200_srb_set_bufflen(srb, 0);
 		} else {
 			usb_stor_dbg(us, "   Media Status not supported, just report okay\n");
-			srb->result = SAM_STAT_GOOD;
+			srb->status.combined = SAM_STAT_GOOD;
 			sendToTransport = 0;
 		}
 		break;
@@ -1276,7 +1276,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
 			isd200_srb_set_bufflen(srb, 0);
 		} else {
 			usb_stor_dbg(us, "   Media Status not supported, just report okay\n");
-			srb->result = SAM_STAT_GOOD;
+			srb->status.combined = SAM_STAT_GOOD;
 			sendToTransport = 0;
 		}
 		break;
@@ -1299,7 +1299,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
 
 		usb_stor_set_xfer_buf((unsigned char *) &readCapacityData,
 				sizeof(readCapacityData), srb);
-		srb->result = SAM_STAT_GOOD;
+		srb->status.combined = SAM_STAT_GOOD;
 		sendToTransport = 0;
 	}
 	break;
@@ -1384,7 +1384,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
 			isd200_srb_set_bufflen(srb, 0);
 		} else {
 			usb_stor_dbg(us, "   Not removable media, just report okay\n");
-			srb->result = SAM_STAT_GOOD;
+			srb->status.combined = SAM_STAT_GOOD;
 			sendToTransport = 0;
 		}
 		break;
@@ -1410,7 +1410,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
 			isd200_srb_set_bufflen(srb, 0);
 		} else {
 			usb_stor_dbg(us, "   Nothing to do, just report okay\n");
-			srb->result = SAM_STAT_GOOD;
+			srb->status.combined = SAM_STAT_GOOD;
 			sendToTransport = 0;
 		}
 		break;
@@ -1418,7 +1418,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
 	default:
 		usb_stor_dbg(us, "Unsupported SCSI command - 0x%X\n",
 			     srb->cmnd[0]);
-		srb->result = DID_ERROR << 16;
+		srb->status.combined = DID_ERROR << 16;
 		sendToTransport = 0;
 		break;
 	}
@@ -1519,7 +1519,7 @@ static void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us)
 
 	if (us->extra == NULL) {
 		usb_stor_dbg(us, "ERROR Driver not initialized\n");
-		srb->result = DID_ERROR << 16;
+		srb->status.combined = DID_ERROR << 16;
 		return;
 	}
 
diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
index 229bf0c1afc9..7f512aa09f1c 100644
--- a/drivers/usb/storage/jumpshot.c
+++ b/drivers/usb/storage/jumpshot.c
@@ -627,10 +627,10 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
 		rc = jumpshot_id_device(us, info);
 		if (rc == USB_STOR_TRANSPORT_GOOD) {
 			info->sense_key = NO_SENSE;
-			srb->result = SUCCESS;
+			srb->status.combined = SUCCESS;
 		} else {
 			info->sense_key = UNIT_ATTENTION;
-			srb->result = SAM_STAT_CHECK_CONDITION;
+			srb->status.combined = SAM_STAT_CHECK_CONDITION;
 		}
 		return rc;
 	}
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
index 3789698d9d3c..4e6d8070b3d2 100644
--- a/drivers/usb/storage/realtek_cr.c
+++ b/drivers/usb/storage/realtek_cr.c
@@ -822,9 +822,9 @@ static void rts51x_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 			if ((srb->cmnd[0] == TEST_UNIT_READY) &&
 			    (chip->pwr_state == US_SUSPEND)) {
 				if (TST_LUN_READY(chip, srb->device->lun)) {
-					srb->result = SAM_STAT_GOOD;
+					srb->status.combined = SAM_STAT_GOOD;
 				} else {
-					srb->result = SAM_STAT_CHECK_CONDITION;
+					srb->status.combined = SAM_STAT_CHECK_CONDITION;
 					memcpy(srb->sense_buffer,
 					       media_not_present,
 					       US_SENSE_SIZE);
@@ -835,12 +835,12 @@ static void rts51x_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 			if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) {
 				int prevent = srb->cmnd[4] & 0x1;
 				if (prevent) {
-					srb->result = SAM_STAT_CHECK_CONDITION;
+					srb->status.combined = SAM_STAT_CHECK_CONDITION;
 					memcpy(srb->sense_buffer,
 					       invalid_cmd_field,
 					       US_SENSE_SIZE);
 				} else {
-					srb->result = SAM_STAT_GOOD;
+					srb->status.combined = SAM_STAT_GOOD;
 				}
 				usb_stor_dbg(us, "ALLOW_MEDIUM_REMOVAL\n");
 				goto out;
@@ -850,7 +850,7 @@ static void rts51x_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 			chip->proto_handler_backup(srb, us);
 			/* Check whether card is plugged in */
 			if (srb->cmnd[0] == TEST_UNIT_READY) {
-				if (srb->result == SAM_STAT_GOOD) {
+				if (srb->status.combined == SAM_STAT_GOOD) {
 					SET_LUN_READY(chip, srb->device->lun);
 					if (card_first_show) {
 						card_first_show = 0;
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index e5a971b83e3f..1e7be15c2604 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -378,7 +378,7 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
 	/* fail the command if we are disconnecting */
 	if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) {
 		usb_stor_dbg(us, "Fail command during disconnect\n");
-		srb->result = DID_NO_CONNECT << 16;
+		srb->status.combined = DID_NO_CONNECT << 16;
 		done(srb);
 		return 0;
 	}
@@ -387,7 +387,7 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
 			(srb->cmnd[0] == ATA_12 || srb->cmnd[0] == ATA_16)) {
 		memcpy(srb->sense_buffer, usb_stor_sense_invalidCDB,
 		       sizeof(usb_stor_sense_invalidCDB));
-		srb->result = SAM_STAT_CHECK_CONDITION;
+		srb->status.combined = SAM_STAT_CHECK_CONDITION;
 		done(srb);
 		return 0;
 	}
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index 5eb895b19c55..eeab940db880 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -560,7 +560,7 @@ static void last_sector_hacks(struct us_data *us, struct scsi_cmnd *srb)
 	if (sector + 1 != sdkp->capacity)
 		goto done;
 
-	if (srb->result == SAM_STAT_GOOD && scsi_get_resid(srb) == 0) {
+	if (srb->status.combined == SAM_STAT_GOOD && scsi_get_resid(srb) == 0) {
 
 		/*
 		 * The command succeeded.  We know this device doesn't
@@ -580,7 +580,7 @@ static void last_sector_hacks(struct us_data *us, struct scsi_cmnd *srb)
 		 */
 		if (++us->last_sector_retries < 3)
 			return;
-		srb->result = SAM_STAT_CHECK_CONDITION;
+		srb->status.combined = SAM_STAT_CHECK_CONDITION;
 		memcpy(srb->sense_buffer, record_not_found,
 				sizeof(record_not_found));
 	}
@@ -616,25 +616,25 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 	 */
 	if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) {
 		usb_stor_dbg(us, "-- command was aborted\n");
-		srb->result = DID_ABORT << 16;
+		srb->status.combined = DID_ABORT << 16;
 		goto Handle_Errors;
 	}
 
 	/* if there is a transport error, reset and don't auto-sense */
 	if (result == USB_STOR_TRANSPORT_ERROR) {
 		usb_stor_dbg(us, "-- transport indicates error, resetting\n");
-		srb->result = DID_ERROR << 16;
+		srb->status.combined = DID_ERROR << 16;
 		goto Handle_Errors;
 	}
 
 	/* if the transport provided its own sense data, don't auto-sense */
 	if (result == USB_STOR_TRANSPORT_NO_SENSE) {
-		srb->result = SAM_STAT_CHECK_CONDITION;
+		srb->status.combined = SAM_STAT_CHECK_CONDITION;
 		last_sector_hacks(us, srb);
 		return;
 	}
 
-	srb->result = SAM_STAT_GOOD;
+	srb->status.combined = SAM_STAT_GOOD;
 
 	/*
 	 * Determine if we need to auto-sense
@@ -727,7 +727,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 
 		if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) {
 			usb_stor_dbg(us, "-- auto-sense aborted\n");
-			srb->result = DID_ABORT << 16;
+			srb->status.combined = DID_ABORT << 16;
 
 			/* If SANE_SENSE caused this problem, disable it */
 			if (sense_size != US_SENSE_SIZE) {
@@ -761,7 +761,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 			 * multi-target device, since failure of an
 			 * auto-sense is perfectly valid
 			 */
-			srb->result = DID_ERROR << 16;
+			srb->status.combined = DID_ERROR << 16;
 			if (!(us->fflags & US_FL_SCM_MULT_TARG))
 				goto Handle_Errors;
 			return;
@@ -802,7 +802,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 #endif
 
 		/* set the result so the higher layers expect this data */
-		srb->result = SAM_STAT_CHECK_CONDITION;
+		srb->status.combined = SAM_STAT_CHECK_CONDITION;
 
 		scdd = scsi_sense_desc_find(srb->sense_buffer,
 					    SCSI_SENSE_BUFFERSIZE, 4);
@@ -821,7 +821,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 			 * won't realize we did an unsolicited auto-sense.
 			 */
 			if (result == USB_STOR_TRANSPORT_GOOD) {
-				srb->result = SAM_STAT_GOOD;
+				srb->status.combined = SAM_STAT_GOOD;
 				srb->sense_buffer[0] = 0x0;
 			}
 
@@ -842,7 +842,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 			 * entering an infinite retry loop.
 			 */
 			else {
-				srb->result = DID_ERROR << 16;
+				srb->status.combined = DID_ERROR << 16;
 				if ((sshdr.response_code & 0x72) == 0x72)
 					srb->sense_buffer[1] = HARDWARE_ERROR;
 				else
@@ -861,7 +861,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 	 */
 	if (unlikely((us->fflags & US_FL_INITIAL_READ10) &&
 			srb->cmnd[0] == READ_10)) {
-		if (srb->result == SAM_STAT_GOOD) {
+		if (srb->status.combined == SAM_STAT_GOOD) {
 			set_bit(US_FLIDX_READ10_WORKED, &us->dflags);
 		} else if (test_bit(US_FLIDX_READ10_WORKED, &us->dflags)) {
 			clear_bit(US_FLIDX_READ10_WORKED, &us->dflags);
@@ -875,15 +875,15 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 		 */
 		if (test_bit(US_FLIDX_REDO_READ10, &us->dflags)) {
 			clear_bit(US_FLIDX_REDO_READ10, &us->dflags);
-			srb->result = DID_IMM_RETRY << 16;
+			srb->status.combined = DID_IMM_RETRY << 16;
 			srb->sense_buffer[0] = 0;
 		}
 	}
 
 	/* Did we transfer less than the minimum amount required? */
-	if ((srb->result == SAM_STAT_GOOD || srb->sense_buffer[2] == 0) &&
+	if ((srb->status.combined == SAM_STAT_GOOD || srb->sense_buffer[2] == 0) &&
 			scsi_bufflen(srb) - scsi_get_resid(srb) < srb->underflow)
-		srb->result = DID_ERROR << 16;
+		srb->status.combined = DID_ERROR << 16;
 
 	last_sector_hacks(us, srb);
 	return;
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index bef89c6bd1d7..3e67c56fcfd8 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -167,7 +167,7 @@ static void uas_zap_pending(struct uas_dev_info *devinfo, int result)
 		uas_log_cmd_state(cmnd, __func__, 0);
 		/* Sense urbs were killed, clear COMMAND_INFLIGHT manually */
 		cmdinfo->state &= ~COMMAND_INFLIGHT;
-		cmnd->result = result << 16;
+		cmnd->status.combined = result << 16;
 		err = uas_try_complete(cmnd, __func__);
 		WARN_ON(err != 0);
 	}
@@ -194,7 +194,7 @@ static void uas_sense(struct urb *urb, struct scsi_cmnd *cmnd)
 		memcpy(cmnd->sense_buffer, sense_iu->sense, len);
 	}
 
-	cmnd->result = sense_iu->status;
+	cmnd->status.combined = sense_iu->status;
 }
 
 static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *prefix,
@@ -339,7 +339,7 @@ static void uas_stat_cmplt(struct urb *urb)
 	switch (iu->iu_id) {
 	case IU_ID_STATUS:
 		uas_sense(urb, cmnd);
-		if (cmnd->result != 0) {
+		if (cmnd->status.combined != 0) {
 			/* cancel data transfers on error */
 			data_in_urb = usb_get_urb(cmdinfo->data_in_urb);
 			data_out_urb = usb_get_urb(cmdinfo->data_out_urb);
@@ -652,7 +652,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
 			(cmnd->cmnd[0] == ATA_12 || cmnd->cmnd[0] == ATA_16)) {
 		memcpy(cmnd->sense_buffer, usb_stor_sense_invalidCDB,
 		       sizeof(usb_stor_sense_invalidCDB));
-		cmnd->result = SAM_STAT_CHECK_CONDITION;
+		cmnd->status.combined = SAM_STAT_CHECK_CONDITION;
 		cmnd->scsi_done(cmnd);
 		return 0;
 	}
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 90aa9c12ffac..88afbfa79f70 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -325,7 +325,7 @@ static int usb_stor_control_thread(void * __us)
 
 		/* has the command timed out *already* ? */
 		if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) {
-			srb->result = DID_ABORT << 16;
+			srb->status.combined = DID_ABORT << 16;
 			goto SkipForAbort;
 		}
 
@@ -337,7 +337,7 @@ static int usb_stor_control_thread(void * __us)
 		 */
 		if (srb->sc_data_direction == DMA_BIDIRECTIONAL) {
 			usb_stor_dbg(us, "UNKNOWN data direction\n");
-			srb->result = DID_ERROR << 16;
+			srb->status.combined = DID_ERROR << 16;
 		}
 
 		/*
@@ -349,14 +349,14 @@ static int usb_stor_control_thread(void * __us)
 			usb_stor_dbg(us, "Bad target number (%d:%llu)\n",
 				     srb->device->id,
 				     srb->device->lun);
-			srb->result = DID_BAD_TARGET << 16;
+			srb->status.combined = DID_BAD_TARGET << 16;
 		}
 
 		else if (srb->device->lun > us->max_lun) {
 			usb_stor_dbg(us, "Bad LUN (%d:%llu)\n",
 				     srb->device->id,
 				     srb->device->lun);
-			srb->result = DID_BAD_TARGET << 16;
+			srb->status.combined = DID_BAD_TARGET << 16;
 		}
 
 		/*
@@ -371,7 +371,7 @@ static int usb_stor_control_thread(void * __us)
 
 			usb_stor_dbg(us, "Faking INQUIRY command\n");
 			fill_inquiry_response(us, data_ptr, 36);
-			srb->result = SAM_STAT_GOOD;
+			srb->status.combined = SAM_STAT_GOOD;
 		}
 
 		/* we've got a command, let's do it! */
@@ -385,7 +385,7 @@ static int usb_stor_control_thread(void * __us)
 		scsi_lock(host);
 
 		/* was the command aborted? */
-		if (srb->result == DID_ABORT << 16) {
+		if (srb->status.combined == DID_ABORT << 16) {
 SkipForAbort:
 			usb_stor_dbg(us, "scsi command aborted\n");
 			srb = NULL;	/* Don't call srb->scsi_done() */
@@ -416,7 +416,7 @@ static int usb_stor_control_thread(void * __us)
 		/* now that the locks are released, notify the SCSI core */
 		if (srb) {
 			usb_stor_dbg(us, "scsi cmd done, result=0x%x\n",
-					srb->result);
+					srb->status.combined);
 			srb->scsi_done(srb);
 		}
 	} /* for (;;) */

  parent reply	other threads:[~2021-04-20  2:14 UTC|newest]

Thread overview: 158+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20  0:06 [PATCH 000/117] Make better use of static type checking Bart Van Assche
2021-04-20  0:06 ` [PATCH 001/117] libsas: Introduce more SAM status code aliases in enum exec_status Bart Van Assche
2021-04-20  0:06 ` [PATCH 002/117] Introduce enums for the SAM, message, host and driver status codes Bart Van Assche
2021-04-20  9:23   ` Steffen Maier
2021-04-20 14:59     ` Bart Van Assche
2021-04-20  0:06 ` [PATCH 003/117] Change the type of the second argument of scsi_host_complete_all_commands() Bart Van Assche
2021-04-20  0:06 ` [PATCH 004/117] libiscsi: Use the host_status enum Bart Van Assche
2021-05-06 16:51   ` Lee Duncan
2021-04-20  0:06 ` [PATCH 005/117] libsas: Use the host_status and sam_status enums Bart Van Assche
2021-04-20  0:06 ` [PATCH 006/117] target: Use enum sam_status instead of u8 Bart Van Assche
2021-04-20  0:06 ` [PATCH 007/117] lpfc: Reformat four comparisons Bart Van Assche
2021-04-21 20:22   ` James Smart
2021-04-20  0:06 ` [PATCH 008/117] fc: Add a compile-time structure size check Bart Van Assche
2021-04-20  0:06 ` [PATCH 009/117] iscsi: " Bart Van Assche
2021-05-06 16:52   ` Lee Duncan
2021-04-20  0:06 ` [PATCH 010/117] ufs: " Bart Van Assche
2021-05-06 23:56   ` Can Guo
2021-04-20  0:06 ` [PATCH 011/117] Introduce the scsi_status union Bart Van Assche
2021-05-06 17:04   ` Lee Duncan
2021-05-07  0:04   ` Can Guo
2021-04-20  0:07 ` [PATCH 012/117] block: Convert SCSI and bsg code to " Bart Van Assche
2021-04-20  0:07 ` [PATCH 013/117] core: Convert " Bart Van Assche
2021-04-20  0:07 ` [PATCH 014/117] ch: Pass union scsi_status to driver_byte() Bart Van Assche
2021-04-20  0:07 ` [PATCH 015/117] sd: Convert to the scsi_status union Bart Van Assche
2021-04-20  0:07 ` [PATCH 016/117] sr: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 017/117] st: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 018/117] sg: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 019/117] 3w*: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 020/117] 53c700: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 021/117] BusLogic: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 022/117] NCR5380: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 023/117] a100u2w: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 024/117] aacraid: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 025/117] acornscsi: Annotate fallthrough Bart Van Assche
2021-04-20  0:07 ` [PATCH 026/117] acornscsi: Convert to the scsi_status union Bart Van Assche
2021-04-20  0:07 ` [PATCH 027/117] advansys: " Bart Van Assche
2021-04-20  1:49   ` Matthew Wilcox
2021-04-20  2:27     ` Douglas Gilbert
2021-04-20  3:20       ` Bart Van Assche
2021-04-20  3:17     ` Bart Van Assche
2021-04-20  3:23       ` Matthew Wilcox
2021-04-20 15:01         ` Bart Van Assche
2021-04-20  0:07 ` [PATCH 028/117] aha*: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 029/117] aic*: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 030/117] arcmsr: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 031/117] ata: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 032/117] atp870u: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 033/117] be2iscsi: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 034/117] bfa: Use type int32_t to represent a signed integer Bart Van Assche
2021-04-20  0:07 ` [PATCH 035/117] bfa: Convert to the scsi_status union Bart Van Assche
2021-04-20  0:07 ` [PATCH 036/117] bnx2fc: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 037/117] cdrom: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 038/117] csiostor: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 039/117] cxlflash: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 040/117] dc395x: Use the set_{host,msg,status}_byte() functions Bart Van Assche
2021-04-20  0:07 ` [PATCH 041/117] dc395x: Convert to the scsi_status union Bart Van Assche
2021-04-20  0:07 ` [PATCH 042/117] dpt_i2o: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 043/117] esas2r: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 044/117] esp_scsi: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 045/117] fas216: Fix two source code comments Bart Van Assche
2021-04-20  0:07 ` [PATCH 046/117] fas216: Convert to the scsi_status union Bart Van Assche
2021-04-20  0:07 ` [PATCH 047/117] fc: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 048/117] fdomain: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 049/117] firewire: sbp2: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 050/117] fnic: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 051/117] hpsa: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 052/117] hptiop: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 053/117] ib_srp: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 054/117] ibmvfc: Fix the documentation of the return value of ibmvfc_host_chkready() Bart Van Assche
2021-04-20  0:07 ` [PATCH 055/117] ibmvfc: Convert to the scsi_status union Bart Van Assche
2021-04-20  0:07 ` [PATCH 056/117] ibmvscsi: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 057/117] ide: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 058/117] imm: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 059/117] initio: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 060/117] ipr: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 061/117] ips: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 062/117] iscsi: " Bart Van Assche
2021-05-06 18:54   ` Lee Duncan
2021-04-20  0:07 ` [PATCH 063/117] libfc: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 064/117] sas: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 065/117] lpfc: " Bart Van Assche
2021-04-21 20:26   ` James Smart
2021-04-20  0:07 ` [PATCH 066/117] mac53c94: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 067/117] megaraid: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 068/117] mesh: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 069/117] message: fusion: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 070/117] mpt3sas: " Bart Van Assche
2021-04-20  0:07 ` [PATCH 071/117] mvumi: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 072/117] myrb: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 073/117] myrs: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 074/117] ncr53c8xx: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 075/117] nfsd: " Bart Van Assche
2021-04-20 14:36   ` Chuck Lever III
2021-04-20 16:44     ` Bart Van Assche
2021-04-21 14:22       ` Chuck Lever III
2021-04-21 16:12         ` Bart Van Assche
2021-04-21 16:27           ` Chuck Lever III
2021-04-20  0:08 ` [PATCH 076/117] nsp32: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 077/117] pcmcia: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 078/117] pktcdvd: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 079/117] pmcraid: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 080/117] ppa: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 081/117] ps3rom: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 082/117] qedf: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 083/117] qedi: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 084/117] qla1280: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 085/117] qla2xxx: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 086/117] qla4xxx: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 087/117] qlogicfas408: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 088/117] qlogicpti: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 089/117] s390/zfcp: " Bart Van Assche
2021-04-20  0:08 ` [PATCH 090/117] scsi_debug: " Bart Van Assche
2021-04-20  2:13 ` [PATCH 091/117] smartpqi: " Bart Van Assche
2021-04-20  2:13 ` [PATCH 092/117] snic: " Bart Van Assche
2021-04-20  2:13 ` [PATCH 093/117] staging: " Bart Van Assche
2021-04-20  7:47   ` Greg Kroah-Hartman
2021-04-20 15:02     ` Bart Van Assche
2021-04-20 15:06       ` Greg Kroah-Hartman
2021-04-20  2:13 ` [PATCH 094/117] stex: " Bart Van Assche
2021-04-20  2:13 ` [PATCH 095/117] storvsc: " Bart Van Assche
2021-04-20 19:39   ` Wei Liu
2021-04-20  2:13 ` [PATCH 096/117] sym53c8xx_2: " Bart Van Assche
2021-04-20  2:13 ` [PATCH 097/117] target: " Bart Van Assche
2021-04-20  2:13 ` [PATCH 098/117] ufs: Remove an unused structure member Bart Van Assche
2021-05-06 23:57   ` Can Guo
2021-04-20  2:13 ` [PATCH 099/117] ufs: Remove a local variable Bart Van Assche
2021-05-06 23:56   ` Can Guo
2021-04-20  2:13 ` [PATCH 100/117] ufs: Use enum sam_status where appropriate Bart Van Assche
2021-05-07  0:01   ` Can Guo
2021-05-07  0:01   ` Can Guo
2021-04-20  2:13 ` [PATCH 101/117] ufs: Remove an assignment from ufshcd_transfer_rsp_status() Bart Van Assche
2021-05-07  0:03   ` Can Guo
2021-04-20  2:13 ` [PATCH 102/117] ufs: Convert to the scsi_status union Bart Van Assche
2021-05-07  0:09   ` Can Guo
2021-05-07  3:35     ` Bart Van Assche
2021-05-07  4:48       ` Can Guo
2021-04-20  2:13 ` Bart Van Assche [this message]
2021-04-20  2:13 ` [PATCH 104/117] virtio-scsi: " Bart Van Assche
2021-04-20  2:13 ` [PATCH 105/117] vmw_pvscsi: " Bart Van Assche
2021-04-20  2:13 ` [PATCH 106/117] wd33c93: " Bart Van Assche
2021-04-20  2:13 ` [PATCH 107/117] wd719x: " Bart Van Assche
2021-04-20  2:13 ` [PATCH 108/117] xen-scsiback: Pass union status to the {status,msg,host,driver}_byte() macros Bart Van Assche
2021-04-20  2:13 ` [PATCH 109/117] xen-scsifront: Convert to the scsi_status union Bart Van Assche
2021-04-20  2:13 ` [PATCH 110/117] Finalize the switch from 'int' to 'union scsi_status' Bart Van Assche
2021-05-06 18:55   ` Lee Duncan
2021-05-07  0:24   ` Can Guo
2021-04-20  2:13 ` [PATCH 111/117] Use the scsi_status union more widely Bart Van Assche
2021-04-20  2:13 ` [PATCH 112/117] Change the return type of scsi_execute() into union scsi_status Bart Van Assche
2021-04-20  2:13 ` [PATCH 113/117] Change the return type of scsi_execute_req() " Bart Van Assche
2021-04-20  2:13 ` [PATCH 114/117] Change the return type of scsi_test_unit_ready() " Bart Van Assche
2021-04-20  2:14 ` [PATCH 115/117] Change the return types of scsi_mode_sense() and sd_do_mode_sense() Bart Van Assche
2021-04-20  2:14 ` [PATCH 116/117] Change the return type of scsi_mode_select() into union scsi_status Bart Van Assche
2021-04-20  2:14 ` [PATCH 117/117] Change the return type of ioctl_internal_command() " Bart Van Assche
2021-04-20  6:04 ` [PATCH 000/117] Make better use of static type checking Hannes Reinecke
2021-04-20 16:12   ` Bart Van Assche
2021-04-20 17:11     ` Hannes Reinecke
2021-04-20 21:10       ` Bart Van Assche
2021-04-20 17:19     ` Douglas Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210420021402.27678-13-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=don.brace@microchip.com \
    --cc=hch@lst.de \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.