Message ID | 20241016131845.898632-1-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers | show |
Series | [v1,1/1] ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24() | expand |
On 10/16/24 22:18, Andy Shevchenko wrote: > 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 <andriy.shevchenko@linux.intel.com> Looks good. Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
On Wed, 16 Oct 2024 16:18:44 +0300, Andy Shevchenko wrote: > Refactor scsi_6_lba_len() with use of get_unaligned_be24() to make it > consistent with other similar helper implementations. > > Applied to libata/linux.git (for-6.13), thanks! [1/1] ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24() https://git.kernel.org/libata/linux/c/08b64eee Kind regards, Niklas
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index f915e3df57a9..4cef824cbafa 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]; } /**
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 <andriy.shevchenko@linux.intel.com> --- drivers/ata/libata-scsi.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)