All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>,
	"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>
Cc: linux-scsi@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Bart Van Assche <bvanassche@acm.org>,
	Kai Makisara <Kai.Makisara@kolumbus.fi>,
	"James E . J . Bottomley" <jejb@linux.ibm.com>
Subject: [PATCH v2 4/5] scsi/st: Use get_unaligned_be24() and sign_extend32()
Date: Thu, 12 Mar 2020 19:37:17 -0700	[thread overview]
Message-ID: <20200313023718.21830-5-bvanassche@acm.org> (raw)
In-Reply-To: <20200313023718.21830-1-bvanassche@acm.org>

Use these functions instead of open-coding them.

Cc: Kai Makisara <Kai.Makisara@kolumbus.fi>
Cc: James E.J. Bottomley <jejb@linux.ibm.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/st.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 393f3019ccac..0f315dadf7e8 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -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",

  parent reply	other threads:[~2020-03-13  2:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-13  2:37 [PATCH v2 0/5] Consolidate {get,put}_unaligned_[bl]e24() definitions Bart Van Assche
2020-03-13  2:37 ` [PATCH v2 1/5] linux/unaligned/byteshift.h: Remove superfluous casts Bart Van Assche
2020-03-13 11:05   ` Christoph Hellwig
2020-03-13  2:37 ` [PATCH v2 2/5] c6x: Include <linux/unaligned/generic.h> instead of duplicating it Bart Van Assche
2020-03-13  2:37 ` [PATCH v2 3/5] treewide: Consolidate {get,put}_unaligned_[bl]e24() definitions Bart Van Assche
2020-03-13  9:15   ` Andy Shevchenko
2020-03-13 14:54     ` Bart Van Assche
2020-03-13 16:33       ` Andy Shevchenko
2020-03-13 16:38         ` Andy Shevchenko
2020-03-13 20:04         ` Bart Van Assche
2020-03-13  9:25   ` Andy Shevchenko
2020-03-13 14:56     ` Bart Van Assche
2020-03-13 11:06   ` Christoph Hellwig
2020-03-13 14:44   ` Felipe Balbi
2020-03-13  2:37 ` Bart Van Assche [this message]
2020-03-13 11:08   ` [PATCH v2 4/5] scsi/st: Use get_unaligned_be24() and sign_extend32() Christoph Hellwig
2020-03-13 15:03     ` Bart Van Assche
2020-03-13  2:37 ` [PATCH v2 5/5] scsi/trace: Use get_unaligned_be24() Bart Van Assche
2020-03-13 11:08   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200313023718.21830-5-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=Kai.Makisara@kolumbus.fi \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=jejb@linux.ibm.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.