aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <[email protected]>2024-10-16 16:18:44 +0300
committerNiklas Cassel <[email protected]>2024-10-17 10:06:37 +0200
commit08b64eeee4d6ce245c9291dd18d249c3b86723b7 (patch)
treecd7c18785f246162370eccdd5900b613aa71c4a8
parent2d910fe1e62c517d69d02996438aea0c4cb73066 (diff)
ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24()
Refactor scsi_6_lba_len() with use of get_unaligned_be24() to make it consistent with other similar helper implementations. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Niklas Cassel <[email protected]>
-rw-r--r--drivers/ata/libata-scsi.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index a4aedf7e1775..c97fc8dc270d 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1334,17 +1334,8 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc)
*/
static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
{
- u64 lba = 0;
- u32 len;
-
- lba |= ((u64)(cdb[1] & 0x1f)) << 16;
- lba |= ((u64)cdb[2]) << 8;
- lba |= ((u64)cdb[3]);
-
- len = cdb[4];
-
- *plba = lba;
- *plen = len;
+ *plba = get_unaligned_be24(&cdb[1]) & 0x1fffff;
+ *plen = cdb[4];
}
/**