From: Harvey Harrison <harvey.harrison@gmail.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-scsi <linux-scsi@vger.kernel.org>
Subject: [PATCH] scsi: gdth.c use unaligned access helpers
Date: Thu, 03 Jul 2008 18:38:43 -0700 [thread overview]
Message-ID: <1215135523.16647.52.camel@brick> (raw)
Remove two now unnecessary local vars.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
drivers/scsi/gdth.c | 23 ++++++++++-------------
1 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 822d521..239274f 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -131,6 +131,7 @@
#include <asm/system.h>
#include <asm/io.h>
#include <asm/uaccess.h>
+#include <asm/unaligned.h>
#include <linux/spinlock.h>
#include <linux/blkdev.h>
#include <linux/scatterlist.h>
@@ -2441,8 +2442,8 @@ static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive)
{
register gdth_cmd_str *cmdp;
struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
- ulong32 cnt, blockcnt;
- ulong64 no, blockno;
+ ulong32 blockcnt;
+ ulong64 blockno;
int i, cmd_index, read_write, sgcnt, mode64;
cmdp = ha->pccb;
@@ -2510,19 +2511,15 @@ static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive)
if (read_write) {
if (scp->cmd_len == 16) {
- memcpy(&no, &scp->cmnd[2], sizeof(ulong64));
- blockno = be64_to_cpu(no);
- memcpy(&cnt, &scp->cmnd[10], sizeof(ulong32));
- blockcnt = be32_to_cpu(cnt);
+ blockno = get_unaligned_be64(&scp->cmnd[2]);
+ blockcnt = get_unaligned_be64(&scp->cmnd[10]);
} else if (scp->cmd_len == 10) {
- memcpy(&no, &scp->cmnd[2], sizeof(ulong32));
- blockno = be32_to_cpu(no);
- memcpy(&cnt, &scp->cmnd[7], sizeof(ushort));
- blockcnt = be16_to_cpu(cnt);
+ blockno = get_unaligned_be32(&scp->cmnd[2]);
+ blockcnt = get_unaligned_be16(&scp->cmnd[7]);
} else {
- memcpy(&no, &scp->cmnd[0], sizeof(ulong32));
- blockno = be32_to_cpu(no) & 0x001fffffUL;
- blockcnt= scp->cmnd[4]==0 ? 0x100 : scp->cmnd[4];
+ blockno = get_unaligned_be32(&scp->cmnd[2]);
+ blockno &= 0x001fffffUL;
+ blockcnt= scp->cmnd[4]==0 ? 0x100 : scp->cmnd[4];
}
if (mode64) {
cmdp->u.cache64.BlockNo = blockno;
--
1.5.6.1.281.g1087e
reply other threads:[~2008-07-04 1:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1215135523.16647.52.camel@brick \
--to=harvey.harrison@gmail.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=akpm@linux-foundation.org \
--cc=linux-scsi@vger.kernel.org \
/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.