diff options
author | John Garry <john.garry@huawei.com> | 2022-02-17 23:42:30 +0800 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2022-02-19 15:59:34 -0500 |
commit | 1d6049a3b14feb39c8d6c8f538a711dcc54f88e0 (patch) | |
tree | 150d6a2eb568f740a033b3405d6f46f8e721be9f /drivers/scsi/isci | |
parent | 9aacf6fe90592cc7f64d56505e42606b61b76f00 (diff) | |
download | lwn-1d6049a3b14feb39c8d6c8f538a711dcc54f88e0.tar.gz lwn-1d6049a3b14feb39c8d6c8f538a711dcc54f88e0.zip |
scsi: libsas: Use enum for response frame DATAPRES field
As defined in table 126 of the SAS spec 1.1, use an enum for the DATAPRES
field, which makes reading the code easier.
Also change sas_ssp_task_response() to use a switch statement, which is
more suitable (than if-else), as suggested by Christoph.
Link: https://lore.kernel.org/r/1645112566-115804-3-git-send-email-john.garry@huawei.com
Suggested-by: Xiang Chen <chenxiang66@hisilicon.com>
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/isci')
-rw-r--r-- | drivers/scsi/isci/request.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index 92394884fbeb..ac17e3a35d2c 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c @@ -1047,7 +1047,8 @@ request_started_state_tc_event(struct isci_request *ireq, resp_iu = &ireq->ssp.rsp; datapres = resp_iu->datapres; - if (datapres == 1 || datapres == 2) { + if (datapres == SAS_DATAPRES_RESPONSE_DATA || + datapres == SAS_DATAPRES_SENSE_DATA) { ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; ireq->sci_status = SCI_FAILURE_IO_RESPONSE_VALID; } else { @@ -1730,8 +1731,8 @@ sci_io_request_frame_handler(struct isci_request *ireq, resp_iu = &ireq->ssp.rsp; - if (resp_iu->datapres == 0x01 || - resp_iu->datapres == 0x02) { + if (resp_iu->datapres == SAS_DATAPRES_RESPONSE_DATA || + resp_iu->datapres == SAS_DATAPRES_SENSE_DATA) { ireq->scu_status = SCU_TASK_DONE_CHECK_RESPONSE; ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; } else { |