public inbox for linux-scsi@vger.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>,
	Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Subject: [PATCH 024/117] aacraid: Convert to the scsi_status union
Date: Mon, 19 Apr 2021 17:07:12 -0700	[thread overview]
Message-ID: <20210420000845.25873-25-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: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/aacraid/aachba.c | 142 +++++++++++++++++-----------------
 1 file changed, 71 insertions(+), 71 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index f1f62b5da8b7..a70b243990d5 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -556,7 +556,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
 		}
 	}
 
-	scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+	scsicmd->status.combined = SAM_STAT_GOOD;
 
 	aac_fib_complete(fibptr);
 	scsicmd->scsi_done(scsicmd);
@@ -614,7 +614,7 @@ static int aac_probe_container_callback2(struct scsi_cmnd * scsicmd)
 	if ((fsa_dev_ptr[scmd_id(scsicmd)].valid & 1))
 		return aac_scsi_cmd(scsicmd);
 
-	scsicmd->result = DID_NO_CONNECT << 16;
+	scsicmd->status.combined = DID_NO_CONNECT << 16;
 	scsicmd->scsi_done(scsicmd);
 	return 0;
 }
@@ -1092,7 +1092,7 @@ static void get_container_serial_callback(void *context, struct fib * fibptr)
 		}
 	}
 
-	scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+	scsicmd->status.combined = SAM_STAT_GOOD;
 
 	aac_fib_complete(fibptr);
 	scsicmd->scsi_done(scsicmd);
@@ -1191,7 +1191,7 @@ static int aac_bounds_32(struct aac_dev * dev, struct scsi_cmnd * cmd, u64 lba)
 	if (lba & 0xffffffff00000000LL) {
 		int cid = scmd_id(cmd);
 		dprintk((KERN_DEBUG "aacraid: Illegal lba\n"));
-		cmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION;
+		cmd->status.combined = SAM_STAT_CHECK_CONDITION;
 		set_sense(&dev->fsa_dev[cid].sense_data,
 		  HARDWARE_ERROR, SENCODE_INTERNAL_TARGET_FAILURE,
 		  ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0);
@@ -2358,11 +2358,11 @@ static void io_callback(void *context, struct fib * fibptr)
 	readreply = (struct aac_read_reply *)fib_data(fibptr);
 	switch (le32_to_cpu(readreply->status)) {
 	case ST_OK:
-		scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+		scsicmd->status.combined = SAM_STAT_GOOD;
 		dev->fsa_dev[cid].sense_data.sense_key = NO_SENSE;
 		break;
 	case ST_NOT_READY:
-		scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION;
+		scsicmd->status.combined = SAM_STAT_CHECK_CONDITION;
 		set_sense(&dev->fsa_dev[cid].sense_data, NOT_READY,
 		  SENCODE_BECOMING_READY, ASENCODE_BECOMING_READY, 0, 0);
 		memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
@@ -2370,7 +2370,7 @@ static void io_callback(void *context, struct fib * fibptr)
 			     SCSI_SENSE_BUFFERSIZE));
 		break;
 	case ST_MEDERR:
-		scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION;
+		scsicmd->status.combined = SAM_STAT_CHECK_CONDITION;
 		set_sense(&dev->fsa_dev[cid].sense_data, MEDIUM_ERROR,
 		  SENCODE_UNRECOVERED_READ_ERROR, ASENCODE_NO_SENSE, 0, 0);
 		memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
@@ -2382,7 +2382,7 @@ static void io_callback(void *context, struct fib * fibptr)
 		printk(KERN_WARNING "io_callback: io failed, status = %d\n",
 		  le32_to_cpu(readreply->status));
 #endif
-		scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION;
+		scsicmd->status.combined = SAM_STAT_CHECK_CONDITION;
 		set_sense(&dev->fsa_dev[cid].sense_data,
 		  HARDWARE_ERROR, SENCODE_INTERNAL_TARGET_FAILURE,
 		  ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0);
@@ -2457,7 +2457,7 @@ static int aac_read(struct scsi_cmnd * scsicmd)
 	if ((lba + count) > (dev->fsa_dev[scmd_id(scsicmd)].size)) {
 		cid = scmd_id(scsicmd);
 		dprintk((KERN_DEBUG "aacraid: Illegal lba\n"));
-		scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION;
+		scsicmd->status.combined = SAM_STAT_CHECK_CONDITION;
 		set_sense(&dev->fsa_dev[cid].sense_data,
 			  ILLEGAL_REQUEST, SENCODE_LBA_OUT_OF_RANGE,
 			  ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0);
@@ -2489,7 +2489,7 @@ static int aac_read(struct scsi_cmnd * scsicmd)
 	/*
 	 *	For some reason, the Fib didn't queue, return QUEUE_FULL
 	 */
-	scsicmd->result = DID_OK << 16 | SAM_STAT_TASK_SET_FULL;
+	scsicmd->status.combined = SAM_STAT_TASK_SET_FULL;
 	scsicmd->scsi_done(scsicmd);
 	aac_fib_complete(cmd_fibcontext);
 	aac_fib_free(cmd_fibcontext);
@@ -2548,7 +2548,7 @@ static int aac_write(struct scsi_cmnd * scsicmd)
 	if ((lba + count) > (dev->fsa_dev[scmd_id(scsicmd)].size)) {
 		cid = scmd_id(scsicmd);
 		dprintk((KERN_DEBUG "aacraid: Illegal lba\n"));
-		scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION;
+		scsicmd->status.combined = SAM_STAT_CHECK_CONDITION;
 		set_sense(&dev->fsa_dev[cid].sense_data,
 			  ILLEGAL_REQUEST, SENCODE_LBA_OUT_OF_RANGE,
 			  ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0);
@@ -2580,7 +2580,7 @@ static int aac_write(struct scsi_cmnd * scsicmd)
 	/*
 	 *	For some reason, the Fib didn't queue, return QUEUE_FULL
 	 */
-	scsicmd->result = DID_OK << 16 | SAM_STAT_TASK_SET_FULL;
+	scsicmd->status.combined = SAM_STAT_TASK_SET_FULL;
 	scsicmd->scsi_done(scsicmd);
 
 	aac_fib_complete(cmd_fibcontext);
@@ -2603,7 +2603,7 @@ static void synchronize_callback(void *context, struct fib *fibptr)
 
 	synchronizereply = fib_data(fibptr);
 	if (le32_to_cpu(synchronizereply->status) == CT_OK)
-		cmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+		cmd->status.combined = SAM_STAT_GOOD;
 	else {
 		struct scsi_device *sdev = cmd->device;
 		struct aac_dev *dev = fibptr->dev;
@@ -2611,7 +2611,7 @@ static void synchronize_callback(void *context, struct fib *fibptr)
 		printk(KERN_WARNING
 		     "synchronize_callback: synchronize failed, status = %d\n",
 		     le32_to_cpu(synchronizereply->status));
-		cmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION;
+		cmd->status.combined = SAM_STAT_CHECK_CONDITION;
 		set_sense(&dev->fsa_dev[cid].sense_data,
 		  HARDWARE_ERROR, SENCODE_INTERNAL_TARGET_FAILURE,
 		  ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0);
@@ -2685,7 +2685,7 @@ static void aac_start_stop_callback(void *context, struct fib *fibptr)
 
 	BUG_ON(fibptr == NULL);
 
-	scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+	scsicmd->status.combined = SAM_STAT_GOOD;
 
 	aac_fib_complete(fibptr);
 	aac_fib_free(fibptr);
@@ -2702,7 +2702,7 @@ static int aac_start_stop(struct scsi_cmnd *scsicmd)
 
 	if (!(aac->supplement_adapter_info.supported_options2 &
 	      AAC_OPTION_POWER_MANAGEMENT)) {
-		scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+		scsicmd->status.combined = SAM_STAT_GOOD;
 		scsicmd->scsi_done(scsicmd);
 		return 0;
 	}
@@ -2777,7 +2777,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 		if (scmd_channel(scsicmd) == CONTAINER_CHANNEL) {
 			if((cid >= dev->maximum_num_containers) ||
 					(scsicmd->device->lun != 0)) {
-				scsicmd->result = DID_NO_CONNECT << 16;
+				scsicmd->status.combined = DID_NO_CONNECT << 16;
 				goto scsi_done_ret;
 			}
 
@@ -2821,7 +2821,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 					return -1;
 				return aac_send_srb_fib(scsicmd);
 			} else {
-				scsicmd->result = DID_NO_CONNECT << 16;
+				scsicmd->status.combined = DID_NO_CONNECT << 16;
 				goto scsi_done_ret;
 			}
 		}
@@ -2833,7 +2833,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 		(scsicmd->cmnd[0] != TEST_UNIT_READY))
 	{
 		dprintk((KERN_WARNING "Only INQUIRY & TUR command supported for controller, rcvd = 0x%x.\n", scsicmd->cmnd[0]));
-		scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION;
+		scsicmd->status.combined = SAM_STAT_CHECK_CONDITION;
 		set_sense(&dev->fsa_dev[cid].sense_data,
 		  ILLEGAL_REQUEST, SENCODE_INVALID_COMMAND,
 		  ASENCODE_INVALID_COMMAND, 0, 0);
@@ -2862,7 +2862,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 
 	case SYNCHRONIZE_CACHE:
 		if (((aac_cache & 6) == 6) && dev->cache_protected) {
-			scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+			scsicmd->status.combined = SAM_STAT_GOOD;
 			break;
 		}
 		/* Issue FIB to tell Firmware to flush it's cache */
@@ -2891,7 +2891,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 				arr[1] = scsicmd->cmnd[2];
 				scsi_sg_copy_from_buffer(scsicmd, &inq_data,
 							 sizeof(inq_data));
-				scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+				scsicmd->status.combined = SAM_STAT_GOOD;
 			} else if (scsicmd->cmnd[2] == 0x80) {
 				/* unit serial number page */
 				arr[3] = setinqserial(dev, &arr[4],
@@ -2902,7 +2902,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 				if (aac_wwn != 2)
 					return aac_get_container_serial(
 						scsicmd);
-				scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+				scsicmd->status.combined = SAM_STAT_GOOD;
 			} else if (scsicmd->cmnd[2] == 0x83) {
 				/* vpd page 0x83 - Device Identification Page */
 				char *sno = (char *)&inq_data;
@@ -2911,10 +2911,10 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 				if (aac_wwn != 2)
 					return aac_get_container_serial(
 						scsicmd);
-				scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+				scsicmd->status.combined = SAM_STAT_GOOD;
 			} else {
 				/* vpd page not implemented */
-				scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION;
+				scsicmd->status.combined = SAM_STAT_CHECK_CONDITION;
 				set_sense(&dev->fsa_dev[cid].sense_data,
 				  ILLEGAL_REQUEST, SENCODE_INVALID_CDB_FIELD,
 				  ASENCODE_NO_SENSE, 7, 2);
@@ -2940,7 +2940,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 			inq_data.inqd_pdt = INQD_PDT_PROC;	/* Processor device */
 			scsi_sg_copy_from_buffer(scsicmd, &inq_data,
 						 sizeof(inq_data));
-			scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+			scsicmd->status.combined = SAM_STAT_GOOD;
 			break;
 		}
 		if (dev->in_reset)
@@ -2989,7 +2989,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 		/* Do not cache partition table for arrays */
 		scsicmd->device->removable = 1;
 
-		scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+		scsicmd->status.combined = SAM_STAT_GOOD;
 		break;
 	}
 
@@ -3015,7 +3015,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 		scsi_sg_copy_from_buffer(scsicmd, cp, sizeof(cp));
 		/* Do not cache partition table for arrays */
 		scsicmd->device->removable = 1;
-		scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+		scsicmd->status.combined = SAM_STAT_GOOD;
 		break;
 	}
 
@@ -3094,7 +3094,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 		scsi_sg_copy_from_buffer(scsicmd,
 					 (char *)&mpd,
 					 mode_buf_length);
-		scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+		scsicmd->status.combined = SAM_STAT_GOOD;
 		break;
 	}
 	case MODE_SENSE_10:
@@ -3171,7 +3171,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 					 (char *)&mpd10,
 					 mode_buf_length);
 
-		scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+		scsicmd->status.combined = SAM_STAT_GOOD;
 		break;
 	}
 	case REQUEST_SENSE:
@@ -3180,7 +3180,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 				sizeof(struct sense_data));
 		memset(&dev->fsa_dev[cid].sense_data, 0,
 				sizeof(struct sense_data));
-		scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+		scsicmd->status.combined = SAM_STAT_GOOD;
 		break;
 
 	case ALLOW_MEDIUM_REMOVAL:
@@ -3190,14 +3190,14 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 		else
 			fsa_dev_ptr[cid].locked = 0;
 
-		scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+		scsicmd->status.combined = SAM_STAT_GOOD;
 		break;
 	/*
 	 *	These commands are all No-Ops
 	 */
 	case TEST_UNIT_READY:
 		if (fsa_dev_ptr[cid].sense_data.sense_key == NOT_READY) {
-			scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION;
+			scsicmd->status.combined = SAM_STAT_CHECK_CONDITION;
 			set_sense(&dev->fsa_dev[cid].sense_data,
 				  NOT_READY, SENCODE_BECOMING_READY,
 				  ASENCODE_BECOMING_READY, 0, 0);
@@ -3214,7 +3214,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 	case REZERO_UNIT:
 	case REASSIGN_BLOCKS:
 	case SEEK_10:
-		scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
+		scsicmd->status.combined = SAM_STAT_GOOD;
 		break;
 
 	case START_STOP:
@@ -3226,7 +3226,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 	 */
 		dprintk((KERN_WARNING "Unhandled SCSI Command: 0x%x.\n",
 				scsicmd->cmnd[0]));
-		scsicmd->result = DID_OK << 16 | SAM_STAT_CHECK_CONDITION;
+		scsicmd->status.combined = SAM_STAT_CHECK_CONDITION;
 		set_sense(&dev->fsa_dev[cid].sense_data,
 			  ILLEGAL_REQUEST, SENCODE_INVALID_COMMAND,
 			  ASENCODE_INVALID_COMMAND, 0, 0);
@@ -3407,7 +3407,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
 				le32_to_cpu(srbreply->status));
 		len = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
 			    SCSI_SENSE_BUFFERSIZE);
-		scsicmd->result = DID_ERROR << 16 | SAM_STAT_CHECK_CONDITION;
+		scsicmd->status.combined = DID_ERROR << 16 | SAM_STAT_CHECK_CONDITION;
 		memcpy(scsicmd->sense_buffer,
 				srbreply->sense_data, len);
 	}
@@ -3419,7 +3419,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
 	case SRB_STATUS_ERROR_RECOVERY:
 	case SRB_STATUS_PENDING:
 	case SRB_STATUS_SUCCESS:
-		scsicmd->result = DID_OK << 16;
+		scsicmd->status.combined = 0;
 		break;
 	case SRB_STATUS_DATA_OVERRUN:
 		switch (scsicmd->cmnd[0]) {
@@ -3436,52 +3436,52 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
 				pr_warn("aacraid: SCSI CMD underflow\n");
 			else
 				pr_warn("aacraid: SCSI CMD Data Overrun\n");
-			scsicmd->result = DID_ERROR << 16;
+			scsicmd->status.combined = DID_ERROR << 16;
 			break;
 		case INQUIRY:
-			scsicmd->result = DID_OK << 16;
+			scsicmd->status.combined = 0;
 			break;
 		default:
-			scsicmd->result = DID_OK << 16;
+			scsicmd->status.combined = 0;
 			break;
 		}
 		break;
 	case SRB_STATUS_ABORTED:
-		scsicmd->result = DID_ABORT << 16;
+		scsicmd->status.combined = DID_ABORT << 16;
 		break;
 	case SRB_STATUS_ABORT_FAILED:
 		/*
 		 * Not sure about this one - but assuming the
 		 * hba was trying to abort for some reason
 		 */
-		scsicmd->result = DID_ERROR << 16;
+		scsicmd->status.combined = DID_ERROR << 16;
 		break;
 	case SRB_STATUS_PARITY_ERROR:
-		scsicmd->result = DID_PARITY << 16;
+		scsicmd->status.combined = DID_PARITY << 16;
 		break;
 	case SRB_STATUS_NO_DEVICE:
 	case SRB_STATUS_INVALID_PATH_ID:
 	case SRB_STATUS_INVALID_TARGET_ID:
 	case SRB_STATUS_INVALID_LUN:
 	case SRB_STATUS_SELECTION_TIMEOUT:
-		scsicmd->result = DID_NO_CONNECT << 16;
+		scsicmd->status.combined = DID_NO_CONNECT << 16;
 		break;
 
 	case SRB_STATUS_COMMAND_TIMEOUT:
 	case SRB_STATUS_TIMEOUT:
-		scsicmd->result = DID_TIME_OUT << 16;
+		scsicmd->status.combined = DID_TIME_OUT << 16;
 		break;
 
 	case SRB_STATUS_BUSY:
-		scsicmd->result = DID_BUS_BUSY << 16;
+		scsicmd->status.combined = DID_BUS_BUSY << 16;
 		break;
 
 	case SRB_STATUS_BUS_RESET:
-		scsicmd->result = DID_RESET << 16;
+		scsicmd->status.combined = DID_RESET << 16;
 		break;
 
 	case SRB_STATUS_MESSAGE_REJECTED:
-		scsicmd->result = DID_ERROR << 16;
+		scsicmd->status.combined = DID_ERROR << 16;
 		break;
 	case SRB_STATUS_REQUEST_FLUSHED:
 	case SRB_STATUS_ERROR:
@@ -3517,12 +3517,12 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
 			|| (scsicmd->cmnd[0] == ATA_16)) {
 
 			if (scsicmd->cmnd[2] & (0x01 << 5)) {
-				scsicmd->result = DID_OK << 16;
+				scsicmd->status.combined = 0;
 			} else {
-				scsicmd->result = DID_ERROR << 16;
+				scsicmd->status.combined = DID_ERROR << 16;
 			}
 		} else {
-			scsicmd->result = DID_ERROR << 16;
+			scsicmd->status.combined = DID_ERROR << 16;
 		}
 		break;
 	}
@@ -3530,7 +3530,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
 			== SAM_STAT_CHECK_CONDITION) {
 		int len;
 
-		scsicmd->result |= SAM_STAT_CHECK_CONDITION;
+		scsicmd->status.combined |= SAM_STAT_CHECK_CONDITION;
 		len = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
 			    SCSI_SENSE_BUFFERSIZE);
 #ifdef AAC_DETAILED_STATUS_INFO
@@ -3544,7 +3544,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
 	/*
 	 * OR in the scsi status (already shifted up a bit)
 	 */
-	scsicmd->result |= le32_to_cpu(srbreply->scsi_status);
+	scsicmd->status.combined |= le32_to_cpu(srbreply->scsi_status);
 
 	aac_fib_complete(fibptr);
 	scsicmd->scsi_done(scsicmd);
@@ -3554,13 +3554,13 @@ static void hba_resp_task_complete(struct aac_dev *dev,
 					struct scsi_cmnd *scsicmd,
 					struct aac_hba_resp *err) {
 
-	scsicmd->result = err->status;
+	scsicmd->status.combined = err->status;
 	/* set residual count */
 	scsi_set_resid(scsicmd, le32_to_cpu(err->residual_count));
 
 	switch (err->status) {
 	case SAM_STAT_GOOD:
-		scsicmd->result |= DID_OK << 16;
+		scsicmd->status.combined |= 0;
 		break;
 	case SAM_STAT_CHECK_CONDITION:
 	{
@@ -3571,19 +3571,19 @@ static void hba_resp_task_complete(struct aac_dev *dev,
 		if (len)
 			memcpy(scsicmd->sense_buffer,
 				err->sense_response_buf, len);
-		scsicmd->result |= DID_OK << 16;
+		scsicmd->status.combined |= 0;
 		break;
 	}
 	case SAM_STAT_BUSY:
-		scsicmd->result |= DID_BUS_BUSY << 16;
+		scsicmd->status.combined |= DID_BUS_BUSY << 16;
 		break;
 	case SAM_STAT_TASK_ABORTED:
-		scsicmd->result |= DID_ABORT << 16;
+		scsicmd->status.combined |= DID_ABORT << 16;
 		break;
 	case SAM_STAT_RESERVATION_CONFLICT:
 	case SAM_STAT_TASK_SET_FULL:
 	default:
-		scsicmd->result |= DID_ERROR << 16;
+		scsicmd->status.combined |= DID_ERROR << 16;
 		break;
 	}
 }
@@ -3603,26 +3603,26 @@ static void hba_resp_task_failure(struct aac_dev *dev,
 			dev->hba_map[bus][cid].devtype = AAC_DEVTYPE_ARC_RAW;
 			dev->hba_map[bus][cid].rmw_nexus = 0xffffffff;
 		}
-		scsicmd->result = DID_NO_CONNECT << 16;
+		scsicmd->status.combined = DID_NO_CONNECT << 16;
 		break;
 	}
 	case HBA_RESP_STAT_IO_ERROR:
 	case HBA_RESP_STAT_NO_PATH_TO_DEVICE:
-		scsicmd->result = DID_OK << 16 | SAM_STAT_BUSY;
+		scsicmd->status.combined = SAM_STAT_BUSY;
 		break;
 	case HBA_RESP_STAT_IO_ABORTED:
-		scsicmd->result = DID_ABORT << 16;
+		scsicmd->status.combined = DID_ABORT << 16;
 		break;
 	case HBA_RESP_STAT_INVALID_DEVICE:
-		scsicmd->result = DID_NO_CONNECT << 16;
+		scsicmd->status.combined = DID_NO_CONNECT << 16;
 		break;
 	case HBA_RESP_STAT_UNDERRUN:
 		/* UNDERRUN is OK */
-		scsicmd->result = DID_OK << 16;
+		scsicmd->status.combined = 0;
 		break;
 	case HBA_RESP_STAT_OVERRUN:
 	default:
-		scsicmd->result = DID_ERROR << 16;
+		scsicmd->status.combined = DID_ERROR << 16;
 		break;
 	}
 }
@@ -3655,7 +3655,7 @@ void aac_hba_callback(void *context, struct fib *fibptr)
 
 	if (fibptr->flags & FIB_CONTEXT_FLAG_FASTRESP) {
 		/* fast response */
-		scsicmd->result = DID_OK << 16;
+		scsicmd->status.combined = 0;
 		goto out;
 	}
 
@@ -3667,17 +3667,17 @@ void aac_hba_callback(void *context, struct fib *fibptr)
 		hba_resp_task_failure(dev, scsicmd, err);
 		break;
 	case HBA_RESP_SVCRES_TMF_REJECTED:
-		scsicmd->result = DID_ERROR << 16;
+		scsicmd->status.combined = DID_ERROR << 16;
 		break;
 	case HBA_RESP_SVCRES_TMF_LUN_INVALID:
-		scsicmd->result = DID_NO_CONNECT << 16;
+		scsicmd->status.combined = DID_NO_CONNECT << 16;
 		break;
 	case HBA_RESP_SVCRES_TMF_COMPLETE:
 	case HBA_RESP_SVCRES_TMF_SUCCEEDED:
-		scsicmd->result = DID_OK << 16;
+		scsicmd->status.combined = 0;
 		break;
 	default:
-		scsicmd->result = DID_ERROR << 16;
+		scsicmd->status.combined = DID_ERROR << 16;
 		break;
 	}
 
@@ -3706,7 +3706,7 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)
 	dev = (struct aac_dev *)scsicmd->device->host->hostdata;
 	if (scmd_id(scsicmd) >= dev->maximum_num_physicals ||
 			scsicmd->device->lun > 7) {
-		scsicmd->result = DID_NO_CONNECT << 16;
+		scsicmd->status.combined = DID_NO_CONNECT << 16;
 		scsicmd->scsi_done(scsicmd);
 		return 0;
 	}
@@ -3747,7 +3747,7 @@ static int aac_send_hba_fib(struct scsi_cmnd *scsicmd)
 	dev = shost_priv(scsicmd->device->host);
 	if (scmd_id(scsicmd) >= dev->maximum_num_physicals ||
 			scsicmd->device->lun > AAC_MAX_LUN - 1) {
-		scsicmd->result = DID_NO_CONNECT << 16;
+		scsicmd->status.combined = DID_NO_CONNECT << 16;
 		scsicmd->scsi_done(scsicmd);
 		return 0;
 	}

  parent reply	other threads:[~2021-04-20  0:09 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 ` Bart Van Assche [this message]
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 ` [PATCH 103/117] usb: " Bart Van Assche
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=20210420000845.25873-25-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=aacraid@microsemi.com \
    --cc=hch@lst.de \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox