From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Bottomley Subject: Re: [patch 10/17] scsi: gdth.c use unaligned access helpers Date: Fri, 03 Oct 2008 11:23:01 -0500 Message-ID: <1223050981.3230.21.camel@localhost.localdomain> References: <200809222156.m8MLum2c032291@imap1.linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: Received: from accolon.hansenpartnership.com ([76.243.235.52]:34408 "EHLO accolon.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752564AbYJCQXd (ORCPT ); Fri, 3 Oct 2008 12:23:33 -0400 In-Reply-To: <200809222156.m8MLum2c032291@imap1.linux-foundation.org> Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: akpm@linux-foundation.org Cc: linux-scsi@vger.kernel.org, harvey.harrison@gmail.com, bharrosh@panasas.com, Matthew Wilcox OK, there are two ways to go on this. Either we eliminate the current SCSI wrappers for this, or we extend them and use them. Matthew Wilcox already has a patch for the extensions, so do we have a consensus? James On Mon, 2008-09-22 at 14:56 -0700, akpm@linux-foundation.org wrote: > From: Harvey Harrison > > Remove two now unnecessary local vars. > > [akpm@linux-foundation.org: coding-style fixes] > Signed-off-by: Harvey Harrison > Cc: Boaz Harrosh > Cc: James Bottomley > Signed-off-by: Andrew Morton > --- > > drivers/scsi/gdth.c | 23 ++++++++++------------- > 1 file changed, 10 insertions(+), 13 deletions(-) > > diff -puN drivers/scsi/gdth.c~scsi-gdthc-use-unaligned-access-helpers drivers/scsi/gdth.c > --- a/drivers/scsi/gdth.c~scsi-gdthc-use-unaligned-access-helpers > +++ a/drivers/scsi/gdth.c > @@ -131,6 +131,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -2429,8 +2430,8 @@ static int gdth_fill_cache_cmd(gdth_ha_s > { > 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; > @@ -2498,19 +2499,15 @@ static int gdth_fill_cache_cmd(gdth_ha_s > > 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; > _ > -- > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html