diff options
author | Damien Le Moal <damien.lemoal@opensource.wdc.com> | 2022-02-20 04:18:04 +0100 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2022-02-23 03:31:20 +0100 |
commit | bf67e693fc40d7b2e32f79427f1284d98ba1c809 (patch) | |
tree | a1f2719b48dc5dd1f2b8da78a7abfbb10e67251a /drivers/scsi | |
parent | scsi: pm8001: Cleanup pm8001_exec_internal_task_abort() (diff) | |
download | linux-bf67e693fc40d7b2e32f79427f1284d98ba1c809.tar.xz linux-bf67e693fc40d7b2e32f79427f1284d98ba1c809.zip |
scsi: pm8001: Simplify pm8001_get_ncq_tag()
To detect if a command is NCQ, there is no need to test all possible NCQ
command codes. Instead, use ata_is_ncq() to test the command protocol.
Link: https://lore.kernel.org/r/20220220031810.738362-26-damien.lemoal@opensource.wdc.com
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/pm8001/pm8001_sas.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index b41f3aa6ce3e..55859d24edd3 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -304,16 +304,12 @@ static int pm8001_task_prep_smp(struct pm8001_hba_info *pm8001_ha, u32 pm8001_get_ncq_tag(struct sas_task *task, u32 *tag) { struct ata_queued_cmd *qc = task->uldd_task; - if (qc) { - if (qc->tf.command == ATA_CMD_FPDMA_WRITE || - qc->tf.command == ATA_CMD_FPDMA_READ || - qc->tf.command == ATA_CMD_FPDMA_RECV || - qc->tf.command == ATA_CMD_FPDMA_SEND || - qc->tf.command == ATA_CMD_NCQ_NON_DATA) { - *tag = qc->tag; - return 1; - } + + if (qc && ata_is_ncq(qc->tf.protocol)) { + *tag = qc->tag; + return 1; } + return 0; } |