aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorDavid Hardeman <david@2gen.com>2005-09-17 03:55:31 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2005-10-29 20:19:43 -0400
commit378f058cc49bcda7fa63d3cd86d2f9a0a5188b1c (patch)
treeed99548aa459054c7b046f0ac96af2cc50683e6e /drivers/scsi
parentd32311fed70d12f14e585feb4653571b1e2b0e6d (diff)
[PATCH] Use sg_set_buf/sg_init_one where applicable
This patch uses sg_set_buf/sg_init_one in some places where it was duplicated. Signed-off-by: David Hardeman <david@2gen.com> Cc: James Bottomley <James.Bottomley@steeleye.com> Cc: Greg KH <greg@kroah.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Jeff Garzik <jgarzik@pobox.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/arm/scsi.h6
-rw-r--r--drivers/scsi/libata-core.c10
-rw-r--r--drivers/scsi/sg.c5
3 files changed, 7 insertions, 14 deletions
diff --git a/drivers/scsi/arm/scsi.h b/drivers/scsi/arm/scsi.h
index 48e1c4d9738b..19937640e2e7 100644
--- a/drivers/scsi/arm/scsi.h
+++ b/drivers/scsi/arm/scsi.h
@@ -10,6 +10,8 @@
10 * Commonly used scsi driver functions. 10 * Commonly used scsi driver functions.
11 */ 11 */
12 12
13#include <linux/scatterlist.h>
14
13#define BELT_AND_BRACES 15#define BELT_AND_BRACES
14 16
15/* 17/*
@@ -22,9 +24,7 @@ static inline int copy_SCp_to_sg(struct scatterlist *sg, Scsi_Pointer *SCp, int
22 24
23 BUG_ON(bufs + 1 > max); 25 BUG_ON(bufs + 1 > max);
24 26
25 sg->page = virt_to_page(SCp->ptr); 27 sg_set_buf(sg, SCp->ptr, SCp->this_residual);
26 sg->offset = offset_in_page(SCp->ptr);
27 sg->length = SCp->this_residual;
28 28
29 if (bufs) 29 if (bufs)
30 memcpy(sg + 1, SCp->buffer + 1, 30 memcpy(sg + 1, SCp->buffer + 1,
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index b1b1c6f01419..5ca97605ff35 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -49,6 +49,7 @@
49#include <linux/suspend.h> 49#include <linux/suspend.h>
50#include <linux/workqueue.h> 50#include <linux/workqueue.h>
51#include <linux/jiffies.h> 51#include <linux/jiffies.h>
52#include <linux/scatterlist.h>
52#include <scsi/scsi.h> 53#include <scsi/scsi.h>
53#include "scsi.h" 54#include "scsi.h"
54#include "scsi_priv.h" 55#include "scsi_priv.h"
@@ -2576,19 +2577,12 @@ void ata_qc_prep(struct ata_queued_cmd *qc)
2576 2577
2577void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen) 2578void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen)
2578{ 2579{
2579 struct scatterlist *sg;
2580
2581 qc->flags |= ATA_QCFLAG_SINGLE; 2580 qc->flags |= ATA_QCFLAG_SINGLE;
2582 2581
2583 memset(&qc->sgent, 0, sizeof(qc->sgent));
2584 qc->sg = &qc->sgent; 2582 qc->sg = &qc->sgent;
2585 qc->n_elem = 1; 2583 qc->n_elem = 1;
2586 qc->buf_virt = buf; 2584 qc->buf_virt = buf;
2587 2585 sg_init_one(qc->sg, buf, buflen);
2588 sg = qc->sg;
2589 sg->page = virt_to_page(buf);
2590 sg->offset = (unsigned long) buf & ~PAGE_MASK;
2591 sg->length = buflen;
2592} 2586}
2593 2587
2594/** 2588/**
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 861e51375d70..07fee811c09e 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -49,6 +49,7 @@ static int sg_version_num = 30533; /* 2 digits for each component */
49#include <linux/seq_file.h> 49#include <linux/seq_file.h>
50#include <linux/blkdev.h> 50#include <linux/blkdev.h>
51#include <linux/delay.h> 51#include <linux/delay.h>
52#include <linux/scatterlist.h>
52 53
53#include "scsi.h" 54#include "scsi.h"
54#include <scsi/scsi_dbg.h> 55#include <scsi/scsi_dbg.h>
@@ -1992,9 +1993,7 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size)
1992 if (!p) 1993 if (!p)
1993 break; 1994 break;
1994 } 1995 }
1995 sclp->page = virt_to_page(p); 1996 sg_set_buf(sclp, p, ret_sz);
1996 sclp->offset = offset_in_page(p);
1997 sclp->length = ret_sz;
1998 1997
1999 SCSI_LOG_TIMEOUT(5, printk("sg_build_build: k=%d, a=0x%p, len=%d\n", 1998 SCSI_LOG_TIMEOUT(5, printk("sg_build_build: k=%d, a=0x%p, len=%d\n",
2000 k, sg_scatg2virt(sclp), ret_sz)); 1999 k, sg_scatg2virt(sclp), ret_sz));