Skip to content

Commit 18676c6

Browse files
ipylypivfloatious
authored andcommitted
ata: libata-core: Set ATA_QCFLAG_RTF_FILLED in fill_result_tf()
ATA_QCFLAG_RTF_FILLED is not specific to ahci and can be used generally to check if qc->result_tf contains valid data. Reviewed-by: Hannes Reinecke <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Reviewed-by: Niklas Cassel <[email protected]> Signed-off-by: Igor Pylypiv <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Niklas Cassel <[email protected]>
1 parent ea3b26a commit 18676c6

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

drivers/ata/libahci.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,13 +2075,6 @@ static void ahci_qc_fill_rtf(struct ata_queued_cmd *qc)
20752075
struct ahci_port_priv *pp = qc->ap->private_data;
20762076
u8 *rx_fis = pp->rx_fis;
20772077

2078-
/*
2079-
* rtf may already be filled (e.g. for successful NCQ commands).
2080-
* If that is the case, we have nothing to do.
2081-
*/
2082-
if (qc->flags & ATA_QCFLAG_RTF_FILLED)
2083-
return;
2084-
20852078
if (pp->fbs_enabled)
20862079
rx_fis += qc->dev->link->pmp * AHCI_RX_FIS_SZ;
20872080

@@ -2095,7 +2088,6 @@ static void ahci_qc_fill_rtf(struct ata_queued_cmd *qc)
20952088
!(qc->flags & ATA_QCFLAG_EH)) {
20962089
ata_tf_from_fis(rx_fis + RX_FIS_PIO_SETUP, &qc->result_tf);
20972090
qc->result_tf.status = (rx_fis + RX_FIS_PIO_SETUP)[15];
2098-
qc->flags |= ATA_QCFLAG_RTF_FILLED;
20992091
return;
21002092
}
21012093

@@ -2118,12 +2110,10 @@ static void ahci_qc_fill_rtf(struct ata_queued_cmd *qc)
21182110
*/
21192111
qc->result_tf.status = fis[2];
21202112
qc->result_tf.error = fis[3];
2121-
qc->flags |= ATA_QCFLAG_RTF_FILLED;
21222113
return;
21232114
}
21242115

21252116
ata_tf_from_fis(rx_fis + RX_FIS_D2H_REG, &qc->result_tf);
2126-
qc->flags |= ATA_QCFLAG_RTF_FILLED;
21272117
}
21282118

21292119
static void ahci_qc_ncq_fill_rtf(struct ata_port *ap, u64 done_mask)
@@ -2158,6 +2148,7 @@ static void ahci_qc_ncq_fill_rtf(struct ata_port *ap, u64 done_mask)
21582148
if (qc && ata_is_ncq(qc->tf.protocol)) {
21592149
qc->result_tf.status = status;
21602150
qc->result_tf.error = error;
2151+
qc->result_tf.flags = qc->tf.flags;
21612152
qc->flags |= ATA_QCFLAG_RTF_FILLED;
21622153
}
21632154
done_mask &= ~(1ULL << tag);
@@ -2182,6 +2173,7 @@ static void ahci_qc_ncq_fill_rtf(struct ata_port *ap, u64 done_mask)
21822173
fis += RX_FIS_SDB;
21832174
qc->result_tf.status = fis[2];
21842175
qc->result_tf.error = fis[3];
2176+
qc->result_tf.flags = qc->tf.flags;
21852177
qc->flags |= ATA_QCFLAG_RTF_FILLED;
21862178
}
21872179
done_mask &= ~(1ULL << tag);

drivers/ata/libata-core.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4794,8 +4794,16 @@ static void fill_result_tf(struct ata_queued_cmd *qc)
47944794
{
47954795
struct ata_port *ap = qc->ap;
47964796

4797+
/*
4798+
* rtf may already be filled (e.g. for successful NCQ commands).
4799+
* If that is the case, we have nothing to do.
4800+
*/
4801+
if (qc->flags & ATA_QCFLAG_RTF_FILLED)
4802+
return;
4803+
47974804
qc->result_tf.flags = qc->tf.flags;
47984805
ap->ops->qc_fill_rtf(qc);
4806+
qc->flags |= ATA_QCFLAG_RTF_FILLED;
47994807
}
48004808

48014809
static void ata_verify_xfer(struct ata_queued_cmd *qc)

0 commit comments

Comments
 (0)