Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bart Van Assche and committed by
Martin K. Petersen
35b703db a7afff31

+2 -2
+2 -2
drivers/scsi/st.c
··· 45 45 46 46 #include <linux/uaccess.h> 47 47 #include <asm/dma.h> 48 + #include <asm/unaligned.h> 48 49 49 50 #include <scsi/scsi.h> 50 51 #include <scsi/scsi_dbg.h> ··· 2681 2680 if (!debugging) 2682 2681 return; 2683 2682 2684 - sc = cmd[2] & 0x80 ? 0xff000000 : 0; 2685 - sc |= (cmd[2] << 16) | (cmd[3] << 8) | cmd[4]; 2683 + sc = sign_extend32(get_unaligned_be24(&cmd[2]), 23); 2686 2684 if (direction) 2687 2685 sc = -sc; 2688 2686 st_printk(ST_DEB_MSG, STp, "Spacing tape %s over %d %s.\n",