Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: libsas: Simplify sas_ata_qc_issue() detection of NCQ commands

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-24-damien.lemoal@opensource.wdc.com
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Damien Le Moal and committed by
Martin K. Petersen
a1e7c799 f792a362

+2 -7
+2 -7
drivers/scsi/libsas/sas_ata.c
··· 179 179 task->task_proto = SAS_PROTOCOL_STP; 180 180 task->task_done = sas_ata_task_done; 181 181 182 - if (qc->tf.command == ATA_CMD_FPDMA_WRITE || 183 - qc->tf.command == ATA_CMD_FPDMA_READ || 184 - qc->tf.command == ATA_CMD_FPDMA_RECV || 185 - qc->tf.command == ATA_CMD_FPDMA_SEND || 186 - qc->tf.command == ATA_CMD_NCQ_NON_DATA) { 187 - /* Need to zero out the tag libata assigned us */ 182 + /* For NCQ commands, zero out the tag libata assigned us */ 183 + if (ata_is_ncq(qc->tf.protocol)) 188 184 qc->tf.nsect = 0; 189 - } 190 185 191 186 ata_tf_to_fis(&qc->tf, qc->dev->link->pmp, 1, (u8 *)&task->ata_task.fis); 192 187 task->uldd_task = qc;