]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
scsi: st: Use get_unaligned_be24() and sign_extend32()
authorBart Van Assche <bvanassche@acm.org>
Fri, 13 Mar 2020 20:31:01 +0000 (13:31 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 17 Mar 2020 02:08:34 +0000 (22:08 -0400)
Use these functions instead of open-coding them.

Link: https://lore.kernel.org/r/20200313203102.16613-5-bvanassche@acm.org
Cc: Kai Makisara <Kai.Makisara@kolumbus.fi>
Cc: James E.J. Bottomley <jejb@linux.ibm.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/st.c

index 2cff8a7349a7af64d551034bf9721d1c7f2a055a..c5f9b348b43825ba9468caa011527fa2b753d4de 100644 (file)
@@ -45,6 +45,7 @@ static const char *verstr = "20160209";
 
 #include <linux/uaccess.h>
 #include <asm/dma.h>
+#include <asm/unaligned.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_dbg.h>
@@ -2680,8 +2681,7 @@ static void deb_space_print(struct scsi_tape *STp, int direction, char *units, u
        if (!debugging)
                return;
 
-       sc = cmd[2] & 0x80 ? 0xff000000 : 0;
-       sc |= (cmd[2] << 16) | (cmd[3] << 8) | cmd[4];
+       sc = sign_extend32(get_unaligned_be24(&cmd[2]), 23);
        if (direction)
                sc = -sc;
        st_printk(ST_DEB_MSG, STp, "Spacing tape %s over %d %s.\n",