diff mbox series

[060/117] ipr: Convert to the scsi_status union

Message ID 20210420000845.25873-61-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".

Cc: Brian King <brking@us.ibm.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/ipr.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 30c30a1db5b1..00b4688d3107 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -863,7 +863,7 @@  static void __ipr_scsi_eh_done(struct ipr_cmnd *ipr_cmd)
 {
 	struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
 
-	scsi_cmd->result |= (DID_ERROR << 16);
+	scsi_cmd->status.combined |= (DID_ERROR << 16);
 
 	scsi_dma_unmap(ipr_cmd->scsi_cmd);
 	scsi_cmd->scsi_done(scsi_cmd);
@@ -6051,7 +6051,7 @@  static void __ipr_erp_done(struct ipr_cmnd *ipr_cmd)
 	u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc);
 
 	if (IPR_IOASC_SENSE_KEY(ioasc) > 0) {
-		scsi_cmd->result |= (DID_ERROR << 16);
+		scsi_cmd->status.combined |= (DID_ERROR << 16);
 		scmd_printk(KERN_ERR, scsi_cmd,
 			    "Request Sense failed with IOASC: 0x%08X\n", ioasc);
 	} else {
@@ -6301,7 +6301,7 @@  static void ipr_gen_sense(struct ipr_cmnd *ipr_cmd)
 	if (ioasc >= IPR_FIRST_DRIVER_IOASC)
 		return;
 
-	ipr_cmd->scsi_cmd->result = SAM_STAT_CHECK_CONDITION;
+	ipr_cmd->scsi_cmd->status.combined = SAM_STAT_CHECK_CONDITION;
 
 	if (ipr_is_vset_device(res) &&
 	    ioasc == IPR_IOASC_MED_DO_NOT_REALLOC &&
@@ -6432,23 +6432,23 @@  static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg,
 	switch (masked_ioasc) {
 	case IPR_IOASC_ABORTED_CMD_TERM_BY_HOST:
 		if (ipr_is_naca_model(res))
-			scsi_cmd->result |= (DID_ABORT << 16);
+			scsi_cmd->status.combined |= (DID_ABORT << 16);
 		else
-			scsi_cmd->result |= (DID_IMM_RETRY << 16);
+			scsi_cmd->status.combined |= (DID_IMM_RETRY << 16);
 		break;
 	case IPR_IOASC_IR_RESOURCE_HANDLE:
 	case IPR_IOASC_IR_NO_CMDS_TO_2ND_IOA:
-		scsi_cmd->result |= (DID_NO_CONNECT << 16);
+		scsi_cmd->status.combined |= (DID_NO_CONNECT << 16);
 		break;
 	case IPR_IOASC_HW_SEL_TIMEOUT:
-		scsi_cmd->result |= (DID_NO_CONNECT << 16);
+		scsi_cmd->status.combined |= (DID_NO_CONNECT << 16);
 		if (!ipr_is_naca_model(res))
 			res->needs_sync_complete = 1;
 		break;
 	case IPR_IOASC_SYNC_REQUIRED:
 		if (!res->in_erp)
 			res->needs_sync_complete = 1;
-		scsi_cmd->result |= (DID_IMM_RETRY << 16);
+		scsi_cmd->status.combined |= (DID_IMM_RETRY << 16);
 		break;
 	case IPR_IOASC_MED_DO_NOT_REALLOC: /* prevent retries */
 	case IPR_IOASA_IR_DUAL_IOA_DISABLED:
@@ -6456,8 +6456,8 @@  static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg,
 		 * exception: do not set DID_PASSTHROUGH on CHECK CONDITION
 		 * so SCSI mid-layer and upper layers handle it accordingly.
 		 */
-		if (scsi_cmd->result != SAM_STAT_CHECK_CONDITION)
-			scsi_cmd->result |= (DID_PASSTHROUGH << 16);
+		if (scsi_cmd->status.combined != SAM_STAT_CHECK_CONDITION)
+			scsi_cmd->status.combined |= (DID_PASSTHROUGH << 16);
 		break;
 	case IPR_IOASC_BUS_WAS_RESET:
 	case IPR_IOASC_BUS_WAS_RESET_BY_OTHER:
@@ -6467,12 +6467,12 @@  static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg,
 		 */
 		if (!res->resetting_device)
 			scsi_report_bus_reset(ioa_cfg->host, scsi_cmd->device->channel);
-		scsi_cmd->result |= (DID_ERROR << 16);
+		scsi_cmd->status.combined |= (DID_ERROR << 16);
 		if (!ipr_is_naca_model(res))
 			res->needs_sync_complete = 1;
 		break;
 	case IPR_IOASC_HW_DEV_BUS_STATUS:
-		scsi_cmd->result |= IPR_IOASC_SENSE_STATUS(ioasc);
+		scsi_cmd->status.combined |= IPR_IOASC_SENSE_STATUS(ioasc);
 		if (IPR_IOASC_SENSE_STATUS(ioasc) == SAM_STAT_CHECK_CONDITION) {
 			if (!ipr_get_autosense(ipr_cmd)) {
 				if (!ipr_is_naca_model(res)) {
@@ -6489,13 +6489,13 @@  static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg,
 	case IPR_IOASC_IR_NON_OPTIMIZED:
 		if (res->raw_mode) {
 			res->raw_mode = 0;
-			scsi_cmd->result |= (DID_IMM_RETRY << 16);
+			scsi_cmd->status.combined |= (DID_IMM_RETRY << 16);
 		} else
-			scsi_cmd->result |= (DID_ERROR << 16);
+			scsi_cmd->status.combined |= (DID_ERROR << 16);
 		break;
 	default:
 		if (IPR_IOASC_SENSE_KEY(ioasc) > RECOVERED_ERROR)
-			scsi_cmd->result |= (DID_ERROR << 16);
+			scsi_cmd->status.combined |= (DID_ERROR << 16);
 		if (!ipr_is_vset_device(res) && !ipr_is_naca_model(res))
 			res->needs_sync_complete = 1;
 		break;
@@ -6571,7 +6571,7 @@  static int ipr_queuecommand(struct Scsi_Host *shost,
 
 	ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
 
-	scsi_cmd->result = (DID_OK << 16);
+	scsi_cmd->status.combined = (DID_OK << 16);
 	res = scsi_cmd->device->hostdata;
 
 	if (ipr_is_gata(res) && res->sata_port) {
@@ -6684,7 +6684,7 @@  static int ipr_queuecommand(struct Scsi_Host *shost,
 err_nodev:
 	spin_lock_irqsave(hrrq->lock, hrrq_flags);
 	memset(scsi_cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
-	scsi_cmd->result = (DID_NO_CONNECT << 16);
+	scsi_cmd->status.combined = (DID_NO_CONNECT << 16);
 	scsi_cmd->scsi_done(scsi_cmd);
 	spin_unlock_irqrestore(hrrq->lock, hrrq_flags);
 	return 0;