[PATCH 064/117] sas: Convert to the scsi_status union

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

Cc: John Garry <john.garry@huawei.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/libsas/sas_scsi_host.c | 8 ++++----
drivers/scsi/scsi_transport_sas.c | 7 ++++---
2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 0be979caf7e3..efa0ef958ed3 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -94,7 +94,7 @@ static void sas_end_task(struct scsi_cmnd *sc, struct sas_task *task)
}
}

- sc->result = (hs << 16) | stat;
+ sc->status.combined = (hs << 16) | stat;
ASSIGN_SAS_TASK(sc, NULL);
sas_free_task(task);
}
@@ -170,7 +170,7 @@ int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)

/* If the device fell off, no sense in issuing commands */
if (test_bit(SAS_DEV_GONE, &dev->state)) {
- cmd->result = DID_BAD_TARGET << 16;
+ cmd->status.combined = DID_BAD_TARGET << 16;
goto out_done;
}

@@ -195,9 +195,9 @@ int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
ASSIGN_SAS_TASK(cmd, NULL);
sas_free_task(task);
if (res == -SAS_QUEUE_FULL)
- cmd->result = DID_SOFT_ERROR << 16; /* retry */
+ cmd->status.combined = DID_SOFT_ERROR << 16; /* retry */
else
- cmd->result = DID_ERROR << 16;
+ cmd->status.combined = DID_ERROR << 16;
out_done:
cmd->scsi_done(cmd);
return 0;
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index c9abed8429c9..2caa1393cf94 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -1229,13 +1229,14 @@ int sas_read_port_mode_page(struct scsi_device *sdev)
char *buffer = kzalloc(BUF_SIZE, GFP_KERNEL), *msdata;
struct sas_end_device *rdev = sas_sdev_to_rdev(sdev);
struct scsi_mode_data mode_data;
- int res, error;
+ union scsi_status res;
+ int error;

if (!buffer)
return -ENOMEM;

- res = scsi_mode_sense(sdev, 1, 0x19, buffer, BUF_SIZE, 30*HZ, 3,
- &mode_data, NULL);
+ res.combined = scsi_mode_sense(sdev, 1, 0x19, buffer, BUF_SIZE, 30*HZ,
+ 3, &mode_data, NULL);

error = -EINVAL;
if (!scsi_status_is_good(res))