]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ata: libata-sata: Use BIT() macro to convert tag to bit field
authorNiklas Cassel <cassel@kernel.org>
Wed, 16 Apr 2025 09:31:31 +0000 (11:31 +0200)
committerDamien Le Moal <dlemoal@kernel.org>
Sun, 20 Apr 2025 23:59:07 +0000 (08:59 +0900)
The BIT() macro is commonly used in the kernel.
Make use of it when converting a tag, fetched from the Successful NCQ
Commands log or the NCQ Command Error log, to a bit field.
This makes the code easier to read.

Suggested-by: Igor Pylypiv <ipylypiv@google.com>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
drivers/ata/libata-sata.c

index 89d3b784706babe13e5f29249c3c69f5fbc4be94..4e3034af285e4943caf82517d65c8c542178cde2 100644 (file)
@@ -1545,7 +1545,7 @@ int ata_eh_get_ncq_success_sense(struct ata_link *link)
                 * If the command does not have any sense data, clear ATA_SENSE.
                 * Keep ATA_QCFLAG_EH_SUCCESS_CMD so that command is finished.
                 */
-               if (!(sense_valid & (1 << tag))) {
+               if (!(sense_valid & BIT(tag))) {
                        qc->result_tf.status &= ~ATA_SENSE;
                        continue;
                }
@@ -1634,7 +1634,7 @@ void ata_eh_analyze_ncq_error(struct ata_link *link)
                return;
        }
 
-       if (!(link->sactive & (1 << tag))) {
+       if (!(link->sactive & BIT(tag))) {
                ata_link_err(link, "log page 10h reported inactive tag %d\n",
                             tag);
                return;