[PATCH 019/117] 3w*: Convert to the scsi_status union

Bart Van Assche
2021-04-20T00:09:25Z

Cc: Adam Radford <aradford@gmail.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/3w-9xxx.c | 12 ++++++------
drivers/scsi/3w-sas.c | 8 ++++----
drivers/scsi/3w-xxxx.c | 20 ++++++++++----------
3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 47028f5e57ab..d986a3ef6d26 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -1018,7 +1018,7 @@ static int twa_fill_sense(TW_Device_Extension *tw_dev, int request_id, int copy_

if (copy_sense) {
memcpy(tw_dev->srb[request_id]->sense_buffer, full_command_packet->header.sense_data, TW_SENSE_DATA_LENGTH);
- tw_dev->srb[request_id]->result = (full_command_packet->command.newcommand.status << 1);
+ tw_dev->srb[request_id]->status.combined = (full_command_packet->command.newcommand.status << 1);
retval = TW_ISR_DONT_RESULT;
goto out;
}
@@ -1336,13 +1336,13 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
twa_scsiop_execute_scsi_complete(tw_dev, request_id);
/* If no error command was a success */
if (error == 0) {
- cmd->result = (DID_OK << 16);
+ cmd->status.combined = (DID_OK << 16);
}

/* If error, command failed */
if (error == 1) {
/* Ask for a host reset */
- cmd->result = (DID_OK << 16) | (CHECK_CONDITION << 1);
+ cmd->status.combined = (DID_OK << 16) | SAM_STAT_CHECK_CONDITION;
}

/* Report residual bytes for single sgl */
@@ -1595,7 +1595,7 @@ static int twa_reset_device_extension(TW_Device_Extension *tw_dev)
if (tw_dev->srb[i]) {
struct scsi_cmnd *cmd = tw_dev->srb[i];

- cmd->result = (DID_RESET << 16);
+ cmd->status.combined = (DID_RESET << 16);
if (twa_command_mapped(cmd))
scsi_dma_unmap(cmd);
cmd->scsi_done(cmd);
@@ -1759,7 +1759,7 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_

/* Check if this FW supports luns */
if ((SCpnt->device->lun != 0) && (tw_dev->tw_compat_info.working_srl < TW_FW_SRL_LUNS_SUPPORTED)) {
- SCpnt->result = (DID_BAD_TARGET << 16);
+ SCpnt->status.combined = (DID_BAD_TARGET << 16);
done(SCpnt);
retval = 0;
goto out;
@@ -1782,7 +1782,7 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
twa_free_request_id(tw_dev, request_id);
break;
case 1:
- SCpnt->result = (DID_ERROR << 16);
+ SCpnt->status.combined = (DID_ERROR << 16);
if (twa_command_mapped(SCpnt))
scsi_dma_unmap(SCpnt);
done(SCpnt);
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index 4fde39da54e4..2f025e343908 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -887,7 +887,7 @@ static int twl_fill_sense(TW_Device_Extension *tw_dev, int i, int request_id, in

if (copy_sense) {
memcpy(tw_dev->srb[request_id]->sense_buffer, header->sense_data, TW_SENSE_DATA_LENGTH);
- tw_dev->srb[request_id]->result = (full_command_packet->command.newcommand.status << 1);
+ tw_dev->srb[request_id]->status.combined = (full_command_packet->command.newcommand.status << 1);
goto out;
}
out:
@@ -1206,7 +1206,7 @@ static irqreturn_t twl_interrupt(int irq, void *dev_instance)
cmd = tw_dev->srb[request_id];

if (!error)
- cmd->result = (DID_OK << 16);
+ cmd->status.combined = (DID_OK << 16);

/* Report residual bytes for single sgl */
if ((scsi_sg_count(cmd) <= 1) && (full_command_packet->command.newcommand.status == 0)) {
@@ -1367,7 +1367,7 @@ static int twl_reset_device_extension(TW_Device_Extension *tw_dev, int ioctl_res
struct scsi_cmnd *cmd = tw_dev->srb[i];

if (cmd) {
- cmd->result = (DID_RESET << 16);
+ cmd->status.combined = (DID_RESET << 16);
scsi_dma_unmap(cmd);
cmd->scsi_done(cmd);
}
@@ -1474,7 +1474,7 @@ static int twl_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
if (retval) {
tw_dev->state[request_id] = TW_S_COMPLETED;
twl_free_request_id(tw_dev, request_id);
- SCpnt->result = (DID_ERROR << 16);
+ SCpnt->status.combined = (DID_ERROR << 16);
done(SCpnt);
retval = 0;
}
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index a7292883b72b..370d8719ca56 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -429,7 +429,7 @@ static int tw_decode_sense(TW_Device_Extension *tw_dev, int request_id, int fill
/* Additional sense code qualifier */
tw_dev->srb[request_id]->sense_buffer[13] = tw_sense_table[i][3];

- tw_dev->srb[request_id]->result = (DID_OK << 16) | (CHECK_CONDITION << 1);
+ tw_dev->srb[request_id]->status.combined = (DID_OK << 16) | SAM_STAT_CHECK_CONDITION;
return TW_ISR_DONT_RESULT; /* Special case for isr to not over-write result */
}
}
@@ -1159,7 +1159,7 @@ static int tw_setfeature(TW_Device_Extension *tw_dev, int parm, int param_size,
printk(KERN_WARNING "3w-xxxx: tw_setfeature(): Bad alignment physical address.\n");
tw_dev->state[request_id] = TW_S_COMPLETED;
tw_state_request_finish(tw_dev, request_id);
- tw_dev->srb[request_id]->result = (DID_OK << 16);
+ tw_dev->srb[request_id]->status.combined = (DID_OK << 16);
tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
}
command_packet->byte8.param.sgl[0].address = param_value;
@@ -1303,7 +1303,7 @@ static int tw_reset_device_extension(TW_Device_Extension *tw_dev)
(tw_dev->state[i] != TW_S_COMPLETED)) {
srb = tw_dev->srb[i];
if (srb != NULL) {
- srb->result = (DID_RESET << 16);
+ srb->status.combined = (DID_RESET << 16);
scsi_dma_unmap(srb);
srb->scsi_done(srb);
}
@@ -1483,7 +1483,7 @@ static int tw_scsiop_inquiry_complete(TW_Device_Extension *tw_dev, int request_i
tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 1;
} else {
tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 0;
- tw_dev->srb[request_id]->result = (DID_BAD_TARGET << 16);
+ tw_dev->srb[request_id]->status.combined = (DID_BAD_TARGET << 16);
return TW_ISR_DONT_RESULT;
}

@@ -1504,7 +1504,7 @@ static int tw_scsiop_mode_sense(TW_Device_Extension *tw_dev, int request_id)
if (tw_dev->srb[request_id]->cmnd[2] != 0x8) {
tw_dev->state[request_id] = TW_S_COMPLETED;
tw_state_request_finish(tw_dev, request_id);
- tw_dev->srb[request_id]->result = (DID_OK << 16);
+ tw_dev->srb[request_id]->status.combined = (DID_OK << 16);
tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
return 0;
}
@@ -1795,7 +1795,7 @@ static int tw_scsiop_request_sense(TW_Device_Extension *tw_dev, int request_id)
tw_state_request_finish(tw_dev, request_id);

/* If we got a request_sense, we probably want a reset, return error */
- tw_dev->srb[request_id]->result = (DID_ERROR << 16);
+ tw_dev->srb[request_id]->status.combined = (DID_ERROR << 16);
tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);

return 0;
@@ -1910,7 +1910,7 @@ static int tw_scsiop_test_unit_ready_complete(TW_Device_Extension *tw_dev, int r
tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 1;
} else {
tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 0;
- tw_dev->srb[request_id]->result = (DID_BAD_TARGET << 16);
+ tw_dev->srb[request_id]->status.combined = (DID_BAD_TARGET << 16);
return TW_ISR_DONT_RESULT;
}

@@ -1984,7 +1984,7 @@ static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_c
if (retval) {
tw_dev->state[request_id] = TW_S_COMPLETED;
tw_state_request_finish(tw_dev, request_id);
- SCpnt->result = (DID_ERROR << 16);
+ SCpnt->status.combined = (DID_ERROR << 16);
done(SCpnt);
retval = 0;
}
@@ -2153,13 +2153,13 @@ static irqreturn_t tw_interrupt(int irq, void *dev_instance)

/* If no error command was a success */
if (error == 0) {
- tw_dev->srb[request_id]->result = (DID_OK << 16);
+ tw_dev->srb[request_id]->status.combined = (DID_OK << 16);
}

/* If error, command failed */
if (error == 1) {
/* Ask for a host reset */
- tw_dev->srb[request_id]->result = (DID_OK << 16) | (CHECK_CONDITION << 1);
+ tw_dev->srb[request_id]->status.combined = (DID_OK << 16) | SAM_STAT_CHECK_CONDITION;
}

/* Now complete the io */