Commit 35b703db authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

scsi: st: Use get_unaligned_be24() and sign_extend32()

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: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a7afff31
...@@ -45,6 +45,7 @@ static const char *verstr = "20160209"; ...@@ -45,6 +45,7 @@ static const char *verstr = "20160209";
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <asm/dma.h> #include <asm/dma.h>
#include <asm/unaligned.h>
#include <scsi/scsi.h> #include <scsi/scsi.h>
#include <scsi/scsi_dbg.h> #include <scsi/scsi_dbg.h>
...@@ -2680,8 +2681,7 @@ static void deb_space_print(struct scsi_tape *STp, int direction, char *units, u ...@@ -2680,8 +2681,7 @@ static void deb_space_print(struct scsi_tape *STp, int direction, char *units, u
if (!debugging) if (!debugging)
return; return;
sc = cmd[2] & 0x80 ? 0xff000000 : 0; sc = sign_extend32(get_unaligned_be24(&cmd[2]), 23);
sc |= (cmd[2] << 16) | (cmd[3] << 8) | cmd[4];
if (direction) if (direction)
sc = -sc; sc = -sc;
st_printk(ST_DEB_MSG, STp, "Spacing tape %s over %d %s.\n", st_printk(ST_DEB_MSG, STp, "Spacing tape %s over %d %s.\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment