From 35b703dbfa156f40b6e702191e43a3766fa71244 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 13 Mar 2020 13:31:01 -0700 Subject: 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 Cc: James E.J. Bottomley Cc: Martin K. Petersen Reviewed-by: Christoph Hellwig Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen --- drivers/scsi/st.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/scsi/st.c') diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 2cff8a7349a7..c5f9b348b438 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -45,6 +45,7 @@ static const char *verstr = "20160209"; #include #include +#include #include #include @@ -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", -- cgit v1.2.3