Skip to content

Commit f544644

Browse files
floatiousdamien-lemoal
authored andcommitted
ata: libata-sata: Simplify sense_valid fetching
While the SENSE DATA VALID field in the ACS-6 specification is 47 bits, we are currently only fetching 32 bits, because these are the only bits that we care about (these bits represent the tags (which can be 0-31)). Thus, replace the existing logic with a simple get_unaligned_le32(). While at it, change the type of sense_valid to u32. Signed-off-by: Niklas Cassel <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Reviewed-by: Igor Pylypiv <[email protected]> Signed-off-by: Damien Le Moal <[email protected]>
1 parent e8866e2 commit f544644

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/ata/libata-sata.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,9 +1509,10 @@ int ata_eh_get_ncq_success_sense(struct ata_link *link)
15091509
struct ata_queued_cmd *qc;
15101510
unsigned int err_mask, tag;
15111511
u8 *sense, sk = 0, asc = 0, ascq = 0;
1512-
u64 sense_valid, val;
15131512
u16 extended_sense;
15141513
bool aux_icc_valid;
1514+
u32 sense_valid;
1515+
u64 val;
15151516
int ret = 0;
15161517

15171518
err_mask = ata_read_log_page(dev, ATA_LOG_SENSE_NCQ, 0, buf, 2);
@@ -1529,8 +1530,7 @@ int ata_eh_get_ncq_success_sense(struct ata_link *link)
15291530
return -EIO;
15301531
}
15311532

1532-
sense_valid = (u64)buf[8] | ((u64)buf[9] << 8) |
1533-
((u64)buf[10] << 16) | ((u64)buf[11] << 24);
1533+
sense_valid = get_unaligned_le32(&buf[8]);
15341534
extended_sense = get_unaligned_le16(&buf[14]);
15351535
aux_icc_valid = extended_sense & BIT(15);
15361536

@@ -1545,7 +1545,7 @@ int ata_eh_get_ncq_success_sense(struct ata_link *link)
15451545
* If the command does not have any sense data, clear ATA_SENSE.
15461546
* Keep ATA_QCFLAG_EH_SUCCESS_CMD so that command is finished.
15471547
*/
1548-
if (!(sense_valid & (1ULL << tag))) {
1548+
if (!(sense_valid & (1 << tag))) {
15491549
qc->result_tf.status &= ~ATA_SENSE;
15501550
continue;
15511551
}

0 commit comments

Comments
 (0)