* [patch 10/17] scsi: gdth.c use unaligned access helpers
@ 2008-09-22 21:56 akpm
2008-09-23 7:08 ` Boaz Harrosh
2008-10-03 16:23 ` James Bottomley
0 siblings, 2 replies; 5+ messages in thread
From: akpm @ 2008-09-22 21:56 UTC (permalink / raw)
To: James.Bottomley; +Cc: linux-scsi, akpm, harvey.harrison, bharrosh
From: Harvey Harrison <harvey.harrison@gmail.com>
Remove two now unnecessary local vars.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
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 <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>
@@ -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;
_
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [patch 10/17] scsi: gdth.c use unaligned access helpers
2008-09-22 21:56 [patch 10/17] scsi: gdth.c use unaligned access helpers akpm
@ 2008-09-23 7:08 ` Boaz Harrosh
2008-10-03 16:23 ` James Bottomley
1 sibling, 0 replies; 5+ messages in thread
From: Boaz Harrosh @ 2008-09-23 7:08 UTC (permalink / raw)
To: akpm; +Cc: James.Bottomley, linux-scsi, harvey.harrison
akpm@linux-foundation.org wrote:
> From: Harvey Harrison <harvey.harrison@gmail.com>
>
> Remove two now unnecessary local vars.
>
> [akpm@linux-foundation.org: coding-style fixes]
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> Cc: Boaz Harrosh <bharrosh@panasas.com>
> Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> 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 <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>
> @@ -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]);
+ blockcnt = get_unaligned_be32(&scp->cmnd[10]);
64 => 32
> } 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;
> _
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [patch 10/17] scsi: gdth.c use unaligned access helpers
2008-09-22 21:56 [patch 10/17] scsi: gdth.c use unaligned access helpers akpm
2008-09-23 7:08 ` Boaz Harrosh
@ 2008-10-03 16:23 ` James Bottomley
2008-10-03 17:24 ` Harvey Harrison
1 sibling, 1 reply; 5+ messages in thread
From: James Bottomley @ 2008-10-03 16:23 UTC (permalink / raw)
To: akpm; +Cc: linux-scsi, harvey.harrison, bharrosh, 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 <harvey.harrison@gmail.com>
>
> Remove two now unnecessary local vars.
>
> [akpm@linux-foundation.org: coding-style fixes]
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> Cc: Boaz Harrosh <bharrosh@panasas.com>
> Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> 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 <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>
> @@ -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
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [patch 10/17] scsi: gdth.c use unaligned access helpers
2008-10-03 16:23 ` James Bottomley
@ 2008-10-03 17:24 ` Harvey Harrison
2008-10-07 19:26 ` Matthew Wilcox
0 siblings, 1 reply; 5+ messages in thread
From: Harvey Harrison @ 2008-10-03 17:24 UTC (permalink / raw)
To: James Bottomley; +Cc: akpm, linux-scsi, bharrosh, Matthew Wilcox
On Fri, Oct 3, 2008 at 9:23 AM, James Bottomley
<James.Bottomley@hansenpartnership.com> wrote:
> 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?
>
Pointers to the extensions please.
Harvey
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch 10/17] scsi: gdth.c use unaligned access helpers
2008-10-03 17:24 ` Harvey Harrison
@ 2008-10-07 19:26 ` Matthew Wilcox
0 siblings, 0 replies; 5+ messages in thread
From: Matthew Wilcox @ 2008-10-07 19:26 UTC (permalink / raw)
To: Harvey Harrison; +Cc: James Bottomley, akpm, linux-scsi, bharrosh
On Fri, Oct 03, 2008 at 10:24:22AM -0700, Harvey Harrison wrote:
> On Fri, Oct 3, 2008 at 9:23 AM, James Bottomley
> <James.Bottomley@hansenpartnership.com> wrote:
> > 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?
> >
>
> Pointers to the extensions please.
http://marc.info/?l=linux-scsi&m=121423418922887&w=2
--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-10-07 19:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-22 21:56 [patch 10/17] scsi: gdth.c use unaligned access helpers akpm
2008-09-23 7:08 ` Boaz Harrosh
2008-10-03 16:23 ` James Bottomley
2008-10-03 17:24 ` Harvey Harrison
2008-10-07 19:26 ` Matthew Wilcox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox