diff mbox series

[030/117] arcmsr: Convert to the scsi_status union

Message ID 20210420000845.25873-31-bvanassche@acm.org
State New
Headers show
Series Make better use of static type checking | expand

Commit Message

Bart Van Assche April 20, 2021, 12:07 a.m. UTC
An explanation of the purpose of this patch is available in the patch
"scsi: Introduce the scsi_status union".

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/arcmsr/arcmsr_hba.c | 38 ++++++++++++++++----------------
 1 file changed, 19 insertions(+), 19 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index 4b79661275c9..c410fcd1c11f 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -1326,7 +1326,7 @@  static void arcmsr_report_sense_info(struct CommandControlBlock *ccb)
 
 	struct scsi_cmnd *pcmd = ccb->pcmd;
 	struct SENSE_DATA *sensebuffer = (struct SENSE_DATA *)pcmd->sense_buffer;
-	pcmd->result = (DID_OK << 16) | (CHECK_CONDITION << 1);
+	pcmd->status.combined = (DID_OK << 16) | SAM_STAT_CHECK_CONDITION;
 	if (sensebuffer) {
 		int sense_data_length =
 			sizeof(struct SENSE_DATA) < SCSI_SENSE_BUFFERSIZE
@@ -1335,7 +1335,7 @@  static void arcmsr_report_sense_info(struct CommandControlBlock *ccb)
 		memcpy(sensebuffer, ccb->arcmsr_cdb.SenseData, sense_data_length);
 		sensebuffer->ErrorCode = SCSI_SENSE_CURRENT_ERRORS;
 		sensebuffer->Valid = 1;
-		pcmd->result |= (DRIVER_SENSE << 24);
+		pcmd->status.b.driver = DRIVER_SENSE;
 	}
 }
 
@@ -1390,13 +1390,13 @@  static void arcmsr_report_ccb_state(struct AdapterControlBlock *acb,
 	if (!error) {
 		if (acb->devstate[id][lun] == ARECA_RAID_GONE)
 			acb->devstate[id][lun] = ARECA_RAID_GOOD;
-		ccb->pcmd->result = DID_OK << 16;
+		ccb->pcmd->status.combined = DID_OK << 16;
 		arcmsr_ccb_complete(ccb);
 	}else{
 		switch (ccb->arcmsr_cdb.DeviceStatus) {
 		case ARCMSR_DEV_SELECT_TIMEOUT: {
 			acb->devstate[id][lun] = ARECA_RAID_GONE;
-			ccb->pcmd->result = DID_NO_CONNECT << 16;
+			ccb->pcmd->status.combined = DID_NO_CONNECT << 16;
 			arcmsr_ccb_complete(ccb);
 			}
 			break;
@@ -1405,7 +1405,7 @@  static void arcmsr_report_ccb_state(struct AdapterControlBlock *acb,
 
 		case ARCMSR_DEV_INIT_FAIL: {
 			acb->devstate[id][lun] = ARECA_RAID_GONE;
-			ccb->pcmd->result = DID_BAD_TARGET << 16;
+			ccb->pcmd->status.combined = DID_BAD_TARGET << 16;
 			arcmsr_ccb_complete(ccb);
 			}
 			break;
@@ -1426,7 +1426,7 @@  static void arcmsr_report_ccb_state(struct AdapterControlBlock *acb,
 				, lun
 				, ccb->arcmsr_cdb.DeviceStatus);
 				acb->devstate[id][lun] = ARECA_RAID_GONE;
-				ccb->pcmd->result = DID_NO_CONNECT << 16;
+				ccb->pcmd->status.combined = DID_NO_CONNECT << 16;
 				arcmsr_ccb_complete(ccb);
 			break;
 		}
@@ -1439,7 +1439,7 @@  static void arcmsr_drain_donequeue(struct AdapterControlBlock *acb, struct Comma
 		if (pCCB->startdone == ARCMSR_CCB_ABORTED) {
 			struct scsi_cmnd *abortcmd = pCCB->pcmd;
 			if (abortcmd) {
-				abortcmd->result |= DID_ABORT << 16;
+				abortcmd->status.combined |= DID_ABORT << 16;
 				arcmsr_ccb_complete(pCCB);
 				printk(KERN_NOTICE "arcmsr%d: pCCB ='0x%p' isr got aborted command \n",
 				acb->host->host_no, pCCB);
@@ -1594,7 +1594,7 @@  static void arcmsr_remove_scsi_devices(struct AdapterControlBlock *acb)
 	for (i = 0; i < acb->maxFreeCCB; i++) {
 		ccb = acb->pccb_pool[i];
 		if (ccb->startdone == ARCMSR_CCB_START) {
-			ccb->pcmd->result = DID_NO_CONNECT << 16;
+			ccb->pcmd->status.combined = DID_NO_CONNECT << 16;
 			arcmsr_pci_unmap_dma(ccb);
 			ccb->pcmd->scsi_done(ccb->pcmd);
 		}
@@ -1686,7 +1686,7 @@  static void arcmsr_remove(struct pci_dev *pdev)
 			struct CommandControlBlock *ccb = acb->pccb_pool[i];
 			if (ccb->startdone == ARCMSR_CCB_START) {
 				ccb->startdone = ARCMSR_CCB_ABORTED;
-				ccb->pcmd->result = DID_ABORT << 16;
+				ccb->pcmd->status.combined = DID_ABORT << 16;
 				arcmsr_ccb_complete(ccb);
 			}
 		}
@@ -3178,7 +3178,7 @@  static void arcmsr_handle_virtual_command(struct AdapterControlBlock *acb,
 		struct scatterlist *sg;
 
 		if (cmd->device->lun) {
-			cmd->result = (DID_TIME_OUT << 16);
+			cmd->status.combined = (DID_TIME_OUT << 16);
 			cmd->scsi_done(cmd);
 			return;
 		}
@@ -3209,7 +3209,7 @@  static void arcmsr_handle_virtual_command(struct AdapterControlBlock *acb,
 	case WRITE_BUFFER:
 	case READ_BUFFER: {
 		if (arcmsr_iop_message_xfer(acb, cmd))
-			cmd->result = (DID_ERROR << 16);
+			cmd->status.combined = (DID_ERROR << 16);
 		cmd->scsi_done(cmd);
 	}
 	break;
@@ -3227,13 +3227,13 @@  static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd,
 	int target = cmd->device->id;
 
 	if (acb->acb_flags & ACB_F_ADAPTER_REMOVED) {
-		cmd->result = (DID_NO_CONNECT << 16);
+		cmd->status.combined = (DID_NO_CONNECT << 16);
 		cmd->scsi_done(cmd);
 		return 0;
 	}
 	cmd->scsi_done = done;
 	cmd->host_scribble = NULL;
-	cmd->result = 0;
+	cmd->status.combined = 0;
 	if (target == 16) {
 		/* virtual device for iop message transfer */
 		arcmsr_handle_virtual_command(acb, cmd);
@@ -3243,7 +3243,7 @@  static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd,
 	if (!ccb)
 		return SCSI_MLQUEUE_HOST_BUSY;
 	if (arcmsr_build_ccb( acb, ccb, cmd ) == FAILED) {
-		cmd->result = (DID_ERROR << 16) | (RESERVATION_CONFLICT << 1);
+		cmd->status.combined = (DID_ERROR << 16) | SAM_STAT_RESERVATION_CONFLICT;
 		cmd->scsi_done(cmd);
 		return 0;
 	}
@@ -3516,7 +3516,7 @@  static int arcmsr_hbaA_polling_ccbdone(struct AdapterControlBlock *acb,
 					, ccb->pcmd->device->id
 					, (u32)ccb->pcmd->device->lun
 					, ccb);
-				ccb->pcmd->result = DID_ABORT << 16;
+				ccb->pcmd->status.combined = DID_ABORT << 16;
 				arcmsr_ccb_complete(ccb);
 				continue;
 			}
@@ -3585,7 +3585,7 @@  static int arcmsr_hbaB_polling_ccbdone(struct AdapterControlBlock *acb,
 					,ccb->pcmd->device->id
 					,(u32)ccb->pcmd->device->lun
 					,ccb);
-				ccb->pcmd->result = DID_ABORT << 16;
+				ccb->pcmd->status.combined = DID_ABORT << 16;
 				arcmsr_ccb_complete(ccb);
 				continue;
 			}
@@ -3647,7 +3647,7 @@  static int arcmsr_hbaC_polling_ccbdone(struct AdapterControlBlock *acb,
 					, pCCB->pcmd->device->id
 					, (u32)pCCB->pcmd->device->lun
 					, pCCB);
-				pCCB->pcmd->result = DID_ABORT << 16;
+				pCCB->pcmd->status.combined = DID_ABORT << 16;
 				arcmsr_ccb_complete(pCCB);
 				continue;
 			}
@@ -3722,7 +3722,7 @@  static int arcmsr_hbaD_polling_ccbdone(struct AdapterControlBlock *acb,
 					, pCCB->pcmd->device->id
 					, (u32)pCCB->pcmd->device->lun
 					, pCCB);
-				pCCB->pcmd->result = DID_ABORT << 16;
+				pCCB->pcmd->status.combined = DID_ABORT << 16;
 				arcmsr_ccb_complete(pCCB);
 				continue;
 			}
@@ -3790,7 +3790,7 @@  static int arcmsr_hbaE_polling_ccbdone(struct AdapterControlBlock *acb,
 					, pCCB->pcmd->device->id
 					, (u32)pCCB->pcmd->device->lun
 					, pCCB);
-				pCCB->pcmd->result = DID_ABORT << 16;
+				pCCB->pcmd->status.combined = DID_ABORT << 16;
 				arcmsr_ccb_complete(pCCB);
 				continue;
 			}