[PATCH 043/117] esas2r: Convert to the scsi_status union

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

Cc: Bradley Grove <linuxdrivers@attotech.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/esas2r/esas2r.h | 2 +-
drivers/scsi/esas2r/esas2r_main.c | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/esas2r/esas2r.h b/drivers/scsi/esas2r/esas2r.h
index ed63f7a9ea54..3823ec7909c4 100644
--- a/drivers/scsi/esas2r/esas2r.h
+++ b/drivers/scsi/esas2r/esas2r.h
@@ -1010,7 +1010,7 @@ void esas2r_complete_request_cb(struct esas2r_adapter *a,
void esas2r_reset_detected(struct esas2r_adapter *a);
void esas2r_target_state_changed(struct esas2r_adapter *ha, u16 targ_id,
u8 state);
-int esas2r_req_status_to_error(u8 req_stat);
+enum host_status esas2r_req_status_to_error(u8 req_stat);
void esas2r_kill_adapter(int i);
void esas2r_free_request(struct esas2r_adapter *a, struct esas2r_request *rq);
struct esas2r_request *esas2r_alloc_request(struct esas2r_adapter *a);
diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c
index a9dd6345f064..0967bfc751cc 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -824,10 +824,10 @@ int esas2r_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
unsigned bufflen;

/* Assume success, if it fails we will fix the result later. */
- cmd->result = DID_OK << 16;
+ cmd->status.combined = DID_OK << 16;

if (unlikely(test_bit(AF_DEGRADED_MODE, &a->flags))) {
- cmd->result = DID_NO_CONNECT << 16;
+ cmd->status.combined = DID_NO_CONNECT << 16;
cmd->scsi_done(cmd);
return 0;
}
@@ -984,7 +984,7 @@ int esas2r_eh_abort(struct scsi_cmnd *cmd)
esas2r_log(ESAS2R_LOG_INFO, "eh_abort (%p)", cmd);

if (test_bit(AF_DEGRADED_MODE, &a->flags)) {
- cmd->result = DID_ABORT << 16;
+ cmd->status.combined = DID_ABORT << 16;

scsi_set_resid(cmd, 0);

@@ -1050,7 +1050,7 @@ int esas2r_eh_abort(struct scsi_cmnd *cmd)
* freed it, or we didn't find it at all. Either way, success!
*/

- cmd->result = DID_ABORT << 16;
+ cmd->status.combined = DID_ABORT << 16;

scsi_set_resid(cmd, 0);

@@ -1523,7 +1523,7 @@ void esas2r_complete_request_cb(struct esas2r_adapter *a,
rq->func_rsp.scsi_rsp.scsi_stat,
rq->cmd);

- rq->cmd->result =
+ rq->cmd->status.combined =
((esas2r_req_status_to_error(rq->req_stat) << 16)
| (rq->func_rsp.scsi_rsp.scsi_stat & STATUS_MASK));

@@ -1873,7 +1873,7 @@ void esas2r_target_state_changed(struct esas2r_adapter *a, u16 targ_id,
}

/* Translate status to a Linux SCSI mid-layer error code */
-int esas2r_req_status_to_error(u8 req_stat)
+enum host_status esas2r_req_status_to_error(u8 req_stat)
{
switch (req_stat) {