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>,
	Kashyap Desai <kashyap.desai@broadcom.com>,
	Sumit Saxena <sumit.saxena@broadcom.com>,
	Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Subject: [PATCH 067/117] megaraid: Convert to the scsi_status union
Date: Mon, 19 Apr 2021 17:07:55 -0700	[thread overview]
Message-ID: <20210420000845.25873-68-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: Kashyap Desai <kashyap.desai@broadcom.com>
Cc: Sumit Saxena <sumit.saxena@broadcom.com>
Cc: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/megaraid.c                     | 50 ++++++++---------
 drivers/scsi/megaraid/megaraid_mbox.c       | 62 ++++++++++-----------
 drivers/scsi/megaraid/megaraid_sas_base.c   | 30 +++++-----
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 20 +++----
 4 files changed, 81 insertions(+), 81 deletions(-)

diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 80f546976c7e..49d072147242 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -585,7 +585,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 
 		/* have just LUN 0 for each target on virtual channels */
 		if (cmd->device->lun) {
-			cmd->result = (DID_BAD_TARGET << 16);
+			cmd->status.combined = (DID_BAD_TARGET << 16);
 			cmd->scsi_done(cmd);
 			return NULL;
 		}
@@ -604,7 +604,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 			max_ldrv_num += 0x80;
 
 		if(ldrv_num > max_ldrv_num ) {
-			cmd->result = (DID_BAD_TARGET << 16);
+			cmd->status.combined = (DID_BAD_TARGET << 16);
 			cmd->scsi_done(cmd);
 			return NULL;
 		}
@@ -616,7 +616,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 			 * Do not support lun >7 for physically accessed
 			 * devices
 			 */
-			cmd->result = (DID_BAD_TARGET << 16);
+			cmd->status.combined = (DID_BAD_TARGET << 16);
 			cmd->scsi_done(cmd);
 			return NULL;
 		}
@@ -636,7 +636,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 			 * If no, return success always
 			 */
 			if( !adapter->has_cluster ) {
-				cmd->result = (DID_OK << 16);
+				cmd->status.combined = (DID_OK << 16);
 				cmd->scsi_done(cmd);
 				return NULL;
 			}
@@ -654,7 +654,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 
 			return scb;
 #else
-			cmd->result = (DID_OK << 16);
+			cmd->status.combined = (DID_OK << 16);
 			cmd->scsi_done(cmd);
 			return NULL;
 #endif
@@ -669,7 +669,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 			memset(buf, 0, cmd->cmnd[4]);
 			kunmap_atomic(buf - sg->offset);
 
-			cmd->result = (DID_OK << 16);
+			cmd->status.combined = (DID_OK << 16);
 			cmd->scsi_done(cmd);
 			return NULL;
 		}
@@ -865,7 +865,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 			 */
 			if( ! adapter->has_cluster ) {
 
-				cmd->result = (DID_BAD_TARGET << 16);
+				cmd->status.combined = (DID_BAD_TARGET << 16);
 				cmd->scsi_done(cmd);
 				return NULL;
 			}
@@ -888,7 +888,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 #endif
 
 		default:
-			cmd->result = (DID_BAD_TARGET << 16);
+			cmd->status.combined = (DID_BAD_TARGET << 16);
 			cmd->scsi_done(cmd);
 			return NULL;
 		}
@@ -1472,7 +1472,7 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
 					"aborted cmd [%x] complete\n",
 					scb->idx);
 
-				scb->cmd->result = (DID_ABORT << 16);
+				scb->cmd->status.combined = (DID_ABORT << 16);
 
 				list_add_tail(SCSI_LIST(scb->cmd),
 						&adapter->completed_list);
@@ -1491,7 +1491,7 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
 					"reset cmd [%x] complete\n",
 					scb->idx);
 
-				scb->cmd->result = (DID_RESET << 16);
+				scb->cmd->status.combined = (DID_RESET << 16);
 
 				list_add_tail(SCSI_LIST(scb->cmd),
 						&adapter->completed_list);
@@ -1565,12 +1565,12 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
 		}
 
 		/* clear result; otherwise, success returns corrupt value */
-		cmd->result = 0;
+		cmd->status.combined = 0;
 
 		/* Convert MegaRAID status to Linux error code */
 		switch (status) {
 		case 0x00:	/* SUCCESS , i.e. SCSI_STATUS_GOOD */
-			cmd->result |= (DID_OK << 16);
+			cmd->status.combined |= (DID_OK << 16);
 			break;
 
 		case 0x02:	/* ERROR_ABORTED, i.e.
@@ -1583,9 +1583,9 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
 				memcpy(cmd->sense_buffer, pthru->reqsensearea,
 						14);
 
-				cmd->result = (DRIVER_SENSE << 24) |
+				cmd->status.combined = (DRIVER_SENSE << 24) |
 					(DID_OK << 16) |
-					(CHECK_CONDITION << 1);
+					SAM_STAT_CHECK_CONDITION;
 			}
 			else {
 				if (mbox->m_out.cmd == MEGA_MBOXCMD_EXTPTHRU) {
@@ -1593,20 +1593,20 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
 					memcpy(cmd->sense_buffer,
 						epthru->reqsensearea, 14);
 
-					cmd->result = (DRIVER_SENSE << 24) |
+					cmd->status.combined = (DRIVER_SENSE << 24) |
 						(DID_OK << 16) |
-						(CHECK_CONDITION << 1);
+						SAM_STAT_CHECK_CONDITION;
 				} else {
 					cmd->sense_buffer[0] = 0x70;
 					cmd->sense_buffer[2] = ABORTED_COMMAND;
-					cmd->result |= (CHECK_CONDITION << 1);
+					cmd->status.b.status = SAM_STAT_CHECK_CONDITION;
 				}
 			}
 			break;
 
 		case 0x08:	/* ERR_DEST_DRIVE_FAILED, i.e.
 				   SCSI_STATUS_BUSY */
-			cmd->result |= (DID_BUS_BUSY << 16) | status;
+			cmd->status.combined |= (DID_BUS_BUSY << 16) | status;
 			break;
 
 		default:
@@ -1616,8 +1616,8 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
 			 * MEGA_RESERVATION_STATUS failed
 			 */
 			if( cmd->cmnd[0] == TEST_UNIT_READY ) {
-				cmd->result |= (DID_ERROR << 16) |
-					(RESERVATION_CONFLICT << 1);
+				cmd->status.combined |= (DID_ERROR << 16) |
+					SAM_STAT_RESERVATION_CONFLICT;
 			}
 			else
 			/*
@@ -1628,12 +1628,12 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
 				(cmd->cmnd[0] == RESERVE ||
 					 cmd->cmnd[0] == RELEASE) ) {
 
-				cmd->result |= (DID_ERROR << 16) |
-					(RESERVATION_CONFLICT << 1);
+				cmd->status.combined |= (DID_ERROR << 16) |
+					SAM_STAT_RESERVATION_CONFLICT;
 			}
 			else
 #endif
-				cmd->result |= (DID_BAD_TARGET << 16)|status;
+				cmd->status.combined |= (DID_BAD_TARGET << 16)|status;
 		}
 
 		mega_free_scb(adapter, scb);
@@ -1983,10 +1983,10 @@ megaraid_abort_and_reset(adapter_t *adapter, struct scsi_cmnd *cmd, int aor)
 				mega_free_scb(adapter, scb);
 
 				if( aor == SCB_ABORT ) {
-					cmd->result = (DID_ABORT << 16);
+					cmd->status.combined = (DID_ABORT << 16);
 				}
 				else {
-					cmd->result = (DID_RESET << 16);
+					cmd->status.combined = (DID_RESET << 16);
 				}
 
 				list_add_tail(SCSI_LIST(cmd),
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index b1a2d3536add..b819365249ea 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -1442,7 +1442,7 @@ megaraid_queue_command_lck(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd
 
 	adapter		= SCP2ADAPTER(scp);
 	scp->scsi_done	= done;
-	scp->result	= 0;
+	scp->status.combined = 0;
 
 	/*
 	 * Allocate and build a SCB request
@@ -1510,12 +1510,12 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 			 * If no, return success always
 			 */
 			if (!adapter->ha) {
-				scp->result = (DID_OK << 16);
+				scp->status.combined = (DID_OK << 16);
 				return NULL;
 			}
 
 			if (!(scb = megaraid_alloc_scb(adapter, scp))) {
-				scp->result = (DID_ERROR << 16);
+				scp->status.combined = (DID_ERROR << 16);
 				*busy = 1;
 				return NULL;
 			}
@@ -1552,7 +1552,7 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 						 __LINE__));
 			}
 		}
-		scp->result = (DID_OK << 16);
+		scp->status.combined = (DID_OK << 16);
 		return NULL;
 
 		case INQUIRY:
@@ -1577,7 +1577,7 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 				scp->sense_buffer[0] = 0x70;
 				scp->sense_buffer[2] = ILLEGAL_REQUEST;
 				scp->sense_buffer[12] = MEGA_INVALID_FIELD_IN_CDB;
-				scp->result = CHECK_CONDITION << 1;
+				scp->status.combined = SAM_STAT_CHECK_CONDITION;
 				return NULL;
 			}
 
@@ -1589,18 +1589,18 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 			 * requests for more than 40 logical drives
 			 */
 			if (SCP2LUN(scp)) {
-				scp->result = (DID_BAD_TARGET << 16);
+				scp->status.combined = (DID_BAD_TARGET << 16);
 				return NULL;
 			}
 			if ((target % 0x80) >= MAX_LOGICAL_DRIVES_40LD) {
-				scp->result = (DID_BAD_TARGET << 16);
+				scp->status.combined = (DID_BAD_TARGET << 16);
 				return NULL;
 			}
 
 
 			/* Allocate a SCB and initialize passthru */
 			if (!(scb = megaraid_alloc_scb(adapter, scp))) {
-				scp->result = (DID_ERROR << 16);
+				scp->status.combined = (DID_ERROR << 16);
 				*busy = 1;
 				return NULL;
 			}
@@ -1645,7 +1645,7 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 			 * Allocate a SCB and initialize mailbox
 			 */
 			if (!(scb = megaraid_alloc_scb(adapter, scp))) {
-				scp->result = (DID_ERROR << 16);
+				scp->status.combined = (DID_ERROR << 16);
 				*busy = 1;
 				return NULL;
 			}
@@ -1712,7 +1712,7 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 
 				megaraid_dealloc_scb(adapter, scb);
 
-				scp->result = (DID_ERROR << 16);
+				scp->status.combined = (DID_ERROR << 16);
 				return NULL;
 			}
 
@@ -1733,7 +1733,7 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 			 * Do we support clustering and is the support enabled
 			 */
 			if (!adapter->ha) {
-				scp->result = (DID_BAD_TARGET << 16);
+				scp->status.combined = (DID_BAD_TARGET << 16);
 				return NULL;
 			}
 
@@ -1741,7 +1741,7 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 			 * Allocate a SCB and initialize mailbox
 			 */
 			if (!(scb = megaraid_alloc_scb(adapter, scp))) {
-				scp->result = (DID_ERROR << 16);
+				scp->status.combined = (DID_ERROR << 16);
 				*busy = 1;
 				return NULL;
 			}
@@ -1759,7 +1759,7 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 			return scb;
 
 		default:
-			scp->result = (DID_BAD_TARGET << 16);
+			scp->status.combined = (DID_BAD_TARGET << 16);
 			return NULL;
 		}
 	}
@@ -1767,7 +1767,7 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 
 		// Do not allow access to target id > 15 or LUN > 7
 		if (target > 15 || SCP2LUN(scp) > 7) {
-			scp->result = (DID_BAD_TARGET << 16);
+			scp->status.combined = (DID_BAD_TARGET << 16);
 			return NULL;
 		}
 
@@ -1803,13 +1803,13 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 
 		// disable channel sweep if fast load option given
 		if (rdev->fast_load) {
-			scp->result = (DID_BAD_TARGET << 16);
+			scp->status.combined = (DID_BAD_TARGET << 16);
 			return NULL;
 		}
 
 		// Allocate a SCB and initialize passthru
 		if (!(scb = megaraid_alloc_scb(adapter, scp))) {
-			scp->result = (DID_ERROR << 16);
+			scp->status.combined = (DID_ERROR << 16);
 			*busy = 1;
 			return NULL;
 		}
@@ -2289,7 +2289,7 @@ megaraid_mbox_dpc(unsigned long devp)
 
 		case 0x00:
 
-			scp->result = (DID_OK << 16);
+			scp->status.combined = (DID_OK << 16);
 			break;
 
 		case 0x02:
@@ -2301,8 +2301,8 @@ megaraid_mbox_dpc(unsigned long devp)
 				memcpy(scp->sense_buffer, pthru->reqsensearea,
 						14);
 
-				scp->result = DRIVER_SENSE << 24 |
-					DID_OK << 16 | CHECK_CONDITION << 1;
+				scp->status.combined = DRIVER_SENSE << 24 |
+					DID_OK << 16 | SAM_STAT_CHECK_CONDITION;
 			}
 			else {
 				if (mbox->cmd == MBOXCMD_EXTPTHRU) {
@@ -2310,20 +2310,20 @@ megaraid_mbox_dpc(unsigned long devp)
 					memcpy(scp->sense_buffer,
 						epthru->reqsensearea, 14);
 
-					scp->result = DRIVER_SENSE << 24 |
+					scp->status.combined = DRIVER_SENSE << 24 |
 						DID_OK << 16 |
-						CHECK_CONDITION << 1;
+						SAM_STAT_CHECK_CONDITION;
 				} else {
 					scp->sense_buffer[0] = 0x70;
 					scp->sense_buffer[2] = ABORTED_COMMAND;
-					scp->result = CHECK_CONDITION << 1;
+					scp->status.combined = SAM_STAT_CHECK_CONDITION;
 				}
 			}
 			break;
 
 		case 0x08:
 
-			scp->result = DID_BUS_BUSY << 16 | status;
+			scp->status.combined = DID_BUS_BUSY << 16 | status;
 			break;
 
 		default:
@@ -2333,8 +2333,8 @@ megaraid_mbox_dpc(unsigned long devp)
 			 * failed
 			 */
 			if (scp->cmnd[0] == TEST_UNIT_READY) {
-				scp->result = DID_ERROR << 16 |
-					RESERVATION_CONFLICT << 1;
+				scp->status.combined = DID_ERROR << 16 |
+					SAM_STAT_RESERVATION_CONFLICT;
 			}
 			else
 			/*
@@ -2344,11 +2344,11 @@ megaraid_mbox_dpc(unsigned long devp)
 			if (status == 1 && (scp->cmnd[0] == RESERVE ||
 					 scp->cmnd[0] == RELEASE)) {
 
-				scp->result = DID_ERROR << 16 |
-					RESERVATION_CONFLICT << 1;
+				scp->status.combined = DID_ERROR << 16 |
+					SAM_STAT_RESERVATION_CONFLICT;
 			}
 			else {
-				scp->result = DID_BAD_TARGET << 16 | status;
+				scp->status.combined = DID_BAD_TARGET << 16 | status;
 			}
 		}
 
@@ -2423,7 +2423,7 @@ megaraid_abort_handler(struct scsi_cmnd *scp)
 			"megaraid: %d[%d:%d], abort from completed list\n",
 				scb->sno, scb->dev_channel, scb->dev_target));
 
-			scp->result = (DID_ABORT << 16);
+			scp->status.combined = (DID_ABORT << 16);
 			scp->scsi_done(scp);
 
 			megaraid_dealloc_scb(adapter, scb);
@@ -2453,7 +2453,7 @@ megaraid_abort_handler(struct scsi_cmnd *scp)
 				"megaraid abort: [%d:%d], driver owner\n",
 				scb->dev_channel, scb->dev_target));
 
-			scp->result = (DID_ABORT << 16);
+			scp->status.combined = (DID_ABORT << 16);
 			scp->scsi_done(scp);
 
 			megaraid_dealloc_scb(adapter, scb);
@@ -2573,7 +2573,7 @@ megaraid_reset_handler(struct scsi_cmnd *scp)
 				scb->sno, scb->dev_channel, scb->dev_target));
 			}
 
-			scb->scp->result = (DID_RESET << 16);
+			scb->scp->status.combined = (DID_RESET << 16);
 			scb->scp->scsi_done(scb->scp);
 
 			megaraid_dealloc_scb(adapter, scb);
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 4d4e9dbe5193..218c38b54be1 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -1784,7 +1784,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
 	    scmd->device->host->hostdata;
 
 	if (instance->unload == 1) {
-		scmd->result = DID_NO_CONNECT << 16;
+		scmd->status.combined = DID_NO_CONNECT << 16;
 		scmd->scsi_done(scmd);
 		return 0;
 	}
@@ -1799,21 +1799,21 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
 		    (DID_REQUEUE << 16)) {
 			return SCSI_MLQUEUE_HOST_BUSY;
 		} else {
-			scmd->result = DID_NO_CONNECT << 16;
+			scmd->status.combined = DID_NO_CONNECT << 16;
 			scmd->scsi_done(scmd);
 			return 0;
 		}
 	}
 
 	if (atomic_read(&instance->adprecovery) == MEGASAS_HW_CRITICAL_ERROR) {
-		scmd->result = DID_NO_CONNECT << 16;
+		scmd->status.combined = DID_NO_CONNECT << 16;
 		scmd->scsi_done(scmd);
 		return 0;
 	}
 
 	mr_device_priv_data = scmd->device->hostdata;
 	if (!mr_device_priv_data) {
-		scmd->result = DID_NO_CONNECT << 16;
+		scmd->status.combined = DID_NO_CONNECT << 16;
 		scmd->scsi_done(scmd);
 		return 0;
 	}
@@ -1825,19 +1825,19 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
 		return SCSI_MLQUEUE_DEVICE_BUSY;
 
 
-	scmd->result = 0;
+	scmd->status.combined = 0;
 
 	if (MEGASAS_IS_LOGICAL(scmd->device) &&
 	    (scmd->device->id >= instance->fw_supported_vd_count ||
 		scmd->device->lun)) {
-		scmd->result = DID_BAD_TARGET << 16;
+		scmd->status.combined = DID_BAD_TARGET << 16;
 		goto out_done;
 	}
 
 	if ((scmd->cmnd[0] == SYNCHRONIZE_CACHE) &&
 	    MEGASAS_IS_LOGICAL(scmd->device) &&
 	    (!instance->fw_sync_cache_support)) {
-		scmd->result = DID_OK << 16;
+		scmd->status.combined = DID_OK << 16;
 		goto out_done;
 	}
 
@@ -2744,7 +2744,7 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
 						struct megasas_cmd, list);
 			list_del_init(&reset_cmd->list);
 			if (reset_cmd->scmd) {
-				reset_cmd->scmd->result = DID_REQUEUE << 16;
+				reset_cmd->scmd->status.combined = DID_REQUEUE << 16;
 				dev_notice(&instance->pdev->dev, "%d:%p reset [%02x]\n",
 					reset_index, reset_cmd,
 					reset_cmd->scmd->cmnd[0]);
@@ -3581,7 +3581,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 	case MFI_CMD_LD_WRITE:
 
 		if (alt_status) {
-			cmd->scmd->result = alt_status << 16;
+			cmd->scmd->status.combined = alt_status << 16;
 			exception = 1;
 		}
 
@@ -3599,18 +3599,18 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 		switch (hdr->cmd_status) {
 
 		case MFI_STAT_OK:
-			cmd->scmd->result = DID_OK << 16;
+			cmd->scmd->status.combined = DID_OK << 16;
 			break;
 
 		case MFI_STAT_SCSI_IO_FAILED:
 		case MFI_STAT_LD_INIT_IN_PROGRESS:
-			cmd->scmd->result =
+			cmd->scmd->status.combined =
 			    (DID_ERROR << 16) | hdr->scsi_status;
 			break;
 
 		case MFI_STAT_SCSI_DONE_WITH_ERROR:
 
-			cmd->scmd->result = (DID_OK << 16) | hdr->scsi_status;
+			cmd->scmd->status.combined = (DID_OK << 16) | hdr->scsi_status;
 
 			if (hdr->scsi_status == SAM_STAT_CHECK_CONDITION) {
 				memset(cmd->scmd->sense_buffer, 0,
@@ -3618,20 +3618,20 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 				memcpy(cmd->scmd->sense_buffer, cmd->sense,
 				       hdr->sense_len);
 
-				cmd->scmd->result |= DRIVER_SENSE << 24;
+				cmd->scmd->status.combined |= DRIVER_SENSE << 24;
 			}
 
 			break;
 
 		case MFI_STAT_LD_OFFLINE:
 		case MFI_STAT_DEVICE_NOT_FOUND:
-			cmd->scmd->result = DID_BAD_TARGET << 16;
+			cmd->scmd->status.combined = DID_BAD_TARGET << 16;
 			break;
 
 		default:
 			dev_printk(KERN_DEBUG, &instance->pdev->dev, "MFI FW status %#x\n",
 			       hdr->cmd_status);
-			cmd->scmd->result = DID_ERROR << 16;
+			cmd->scmd->status.combined = DID_ERROR << 16;
 			break;
 		}
 
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 2221175ae051..c70e7ce72123 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -2035,23 +2035,23 @@ map_cmd_status(struct fusion_context *fusion,
 	switch (status) {
 
 	case MFI_STAT_OK:
-		scmd->result = DID_OK << 16;
+		scmd->status.combined = DID_OK << 16;
 		break;
 
 	case MFI_STAT_SCSI_IO_FAILED:
 	case MFI_STAT_LD_INIT_IN_PROGRESS:
-		scmd->result = (DID_ERROR << 16) | ext_status;
+		scmd->status.combined = (DID_ERROR << 16) | ext_status;
 		break;
 
 	case MFI_STAT_SCSI_DONE_WITH_ERROR:
 
-		scmd->result = (DID_OK << 16) | ext_status;
+		scmd->status.combined = (DID_OK << 16) | ext_status;
 		if (ext_status == SAM_STAT_CHECK_CONDITION) {
 			memset(scmd->sense_buffer, 0,
 			       SCSI_SENSE_BUFFERSIZE);
 			memcpy(scmd->sense_buffer, sense,
 			       SCSI_SENSE_BUFFERSIZE);
-			scmd->result |= DRIVER_SENSE << 24;
+			scmd->status.combined |= DRIVER_SENSE << 24;
 		}
 
 		/*
@@ -2073,13 +2073,13 @@ map_cmd_status(struct fusion_context *fusion,
 
 	case MFI_STAT_LD_OFFLINE:
 	case MFI_STAT_DEVICE_NOT_FOUND:
-		scmd->result = DID_BAD_TARGET << 16;
+		scmd->status.combined = DID_BAD_TARGET << 16;
 		break;
 	case MFI_STAT_CONFIG_SEQ_MISMATCH:
-		scmd->result = DID_IMM_RETRY << 16;
+		scmd->status.combined = DID_IMM_RETRY << 16;
 		break;
 	default:
-		scmd->result = DID_ERROR << 16;
+		scmd->status.combined = DID_ERROR << 16;
 		break;
 	}
 }
@@ -4699,7 +4699,7 @@ int megasas_task_abort_fusion(struct scsi_cmnd *scmd)
 	if (!mr_device_priv_data) {
 		sdev_printk(KERN_INFO, scmd->device, "device been deleted! "
 			"scmd(%p)\n", scmd);
-		scmd->result = DID_NO_CONNECT << 16;
+		scmd->status.combined = DID_NO_CONNECT << 16;
 		ret = SUCCESS;
 		goto out;
 	}
@@ -4780,7 +4780,7 @@ int megasas_reset_target_fusion(struct scsi_cmnd *scmd)
 	if (!mr_device_priv_data) {
 		sdev_printk(KERN_INFO, scmd->device,
 			    "device been deleted! scmd: (0x%p)\n", scmd);
-		scmd->result = DID_NO_CONNECT << 16;
+		scmd->status.combined = DID_NO_CONNECT << 16;
 		ret = SUCCESS;
 		goto out;
 	}
@@ -4959,7 +4959,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
 					MPI2_FUNCTION_SCSI_IO_REQUEST)
 					fpio_count++;
 
-				scmd_local->result =
+				scmd_local->status.combined =
 					megasas_check_mpio_paths(instance,
 							scmd_local);
 				if (instance->ldio_threshold &&

  parent reply	other threads:[~2021-04-20  0:10 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 ` Bart Van Assche [this message]
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-68-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=shivasharan.srikanteshwara@broadcom.com \
    --cc=sumit.saxena@broadcom.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