aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-10-22 15:19:53 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-10-22 15:19:53 -0400
commit45711f1af6eff1a6d010703b4862e0d2b9afd056 (patch)
tree3d0048f46e3df9d217d56127462ebe680348bd5a /drivers/block
parent78c2f0b8c285c5305b3e67b0595200541e15eb43 (diff)
[SG] Update drivers to use sg helpers
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/DAC960.c2
-rw-r--r--drivers/block/cciss.c4
-rw-r--r--drivers/block/cpqarray.c3
-rw-r--r--drivers/block/cryptoloop.c12
-rw-r--r--drivers/block/sunvdc.c1
-rw-r--r--drivers/block/sx8.c1
-rw-r--r--drivers/block/ub.c11
-rw-r--r--drivers/block/viodasd.c2
8 files changed, 24 insertions, 12 deletions
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index 84d6aa500e26..53505422867c 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -345,6 +345,7 @@ static bool DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
345 Command->V1.ScatterGatherList = 345 Command->V1.ScatterGatherList =
346 (DAC960_V1_ScatterGatherSegment_T *)ScatterGatherCPU; 346 (DAC960_V1_ScatterGatherSegment_T *)ScatterGatherCPU;
347 Command->V1.ScatterGatherListDMA = ScatterGatherDMA; 347 Command->V1.ScatterGatherListDMA = ScatterGatherDMA;
348 sg_init_table(Command->cmd_sglist, DAC960_V1_ScatterGatherLimit);
348 } else { 349 } else {
349 Command->cmd_sglist = Command->V2.ScatterList; 350 Command->cmd_sglist = Command->V2.ScatterList;
350 Command->V2.ScatterGatherList = 351 Command->V2.ScatterGatherList =
@@ -353,6 +354,7 @@ static bool DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
353 Command->V2.RequestSense = 354 Command->V2.RequestSense =
354 (DAC960_SCSI_RequestSense_T *)RequestSenseCPU; 355 (DAC960_SCSI_RequestSense_T *)RequestSenseCPU;
355 Command->V2.RequestSenseDMA = RequestSenseDMA; 356 Command->V2.RequestSenseDMA = RequestSenseDMA;
357 sg_init_table(Command->cmd_sglist, DAC960_V2_ScatterGatherLimit);
356 } 358 }
357 } 359 }
358 return true; 360 return true;
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 7c2cfde08f18..5a6fe17fc638 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -2610,7 +2610,7 @@ static void do_cciss_request(struct request_queue *q)
2610 (int)creq->nr_sectors); 2610 (int)creq->nr_sectors);
2611#endif /* CCISS_DEBUG */ 2611#endif /* CCISS_DEBUG */
2612 2612
2613 memset(tmp_sg, 0, sizeof(tmp_sg)); 2613 sg_init_table(tmp_sg, MAXSGENTRIES);
2614 seg = blk_rq_map_sg(q, creq, tmp_sg); 2614 seg = blk_rq_map_sg(q, creq, tmp_sg);
2615 2615
2616 /* get the DMA records for the setup */ 2616 /* get the DMA records for the setup */
@@ -2621,7 +2621,7 @@ static void do_cciss_request(struct request_queue *q)
2621 2621
2622 for (i = 0; i < seg; i++) { 2622 for (i = 0; i < seg; i++) {
2623 c->SG[i].Len = tmp_sg[i].length; 2623 c->SG[i].Len = tmp_sg[i].length;
2624 temp64.val = (__u64) pci_map_page(h->pdev, tmp_sg[i].page, 2624 temp64.val = (__u64) pci_map_page(h->pdev, sg_page(&tmp_sg[i]),
2625 tmp_sg[i].offset, 2625 tmp_sg[i].offset,
2626 tmp_sg[i].length, dir); 2626 tmp_sg[i].length, dir);
2627 c->SG[i].Addr.lower = temp64.val32.lower; 2627 c->SG[i].Addr.lower = temp64.val32.lower;
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index 568603d3043e..efab27fa1083 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -918,6 +918,7 @@ queue_next:
918DBGPX( 918DBGPX(
919 printk("sector=%d, nr_sectors=%d\n", creq->sector, creq->nr_sectors); 919 printk("sector=%d, nr_sectors=%d\n", creq->sector, creq->nr_sectors);
920); 920);
921 sg_init_table(tmp_sg, SG_MAX);
921 seg = blk_rq_map_sg(q, creq, tmp_sg); 922 seg = blk_rq_map_sg(q, creq, tmp_sg);
922 923
923 /* Now do all the DMA Mappings */ 924 /* Now do all the DMA Mappings */
@@ -929,7 +930,7 @@ DBGPX(
929 { 930 {
930 c->req.sg[i].size = tmp_sg[i].length; 931 c->req.sg[i].size = tmp_sg[i].length;
931 c->req.sg[i].addr = (__u32) pci_map_page(h->pci_dev, 932 c->req.sg[i].addr = (__u32) pci_map_page(h->pci_dev,
932 tmp_sg[i].page, 933 sg_page(&tmp_sg[i]),
933 tmp_sg[i].offset, 934 tmp_sg[i].offset,
934 tmp_sg[i].length, dir); 935 tmp_sg[i].length, dir);
935 } 936 }
diff --git a/drivers/block/cryptoloop.c b/drivers/block/cryptoloop.c
index 40535036e893..1b58b010797f 100644
--- a/drivers/block/cryptoloop.c
+++ b/drivers/block/cryptoloop.c
@@ -26,6 +26,7 @@
26#include <linux/crypto.h> 26#include <linux/crypto.h>
27#include <linux/blkdev.h> 27#include <linux/blkdev.h>
28#include <linux/loop.h> 28#include <linux/loop.h>
29#include <linux/scatterlist.h>
29#include <asm/semaphore.h> 30#include <asm/semaphore.h>
30#include <asm/uaccess.h> 31#include <asm/uaccess.h>
31 32
@@ -119,14 +120,17 @@ cryptoloop_transfer(struct loop_device *lo, int cmd,
119 .tfm = tfm, 120 .tfm = tfm,
120 .flags = CRYPTO_TFM_REQ_MAY_SLEEP, 121 .flags = CRYPTO_TFM_REQ_MAY_SLEEP,
121 }; 122 };
122 struct scatterlist sg_out = { NULL, }; 123 struct scatterlist sg_out;
123 struct scatterlist sg_in = { NULL, }; 124 struct scatterlist sg_in;
124 125
125 encdec_cbc_t encdecfunc; 126 encdec_cbc_t encdecfunc;
126 struct page *in_page, *out_page; 127 struct page *in_page, *out_page;
127 unsigned in_offs, out_offs; 128 unsigned in_offs, out_offs;
128 int err; 129 int err;
129 130
131 sg_init_table(&sg_out, 1);
132 sg_init_table(&sg_in, 1);
133
130 if (cmd == READ) { 134 if (cmd == READ) {
131 in_page = raw_page; 135 in_page = raw_page;
132 in_offs = raw_off; 136 in_offs = raw_off;
@@ -146,11 +150,11 @@ cryptoloop_transfer(struct loop_device *lo, int cmd,
146 u32 iv[4] = { 0, }; 150 u32 iv[4] = { 0, };
147 iv[0] = cpu_to_le32(IV & 0xffffffff); 151 iv[0] = cpu_to_le32(IV & 0xffffffff);
148 152
149 sg_in.page = in_page; 153 sg_set_page(&sg_in, in_page);
150 sg_in.offset = in_offs; 154 sg_in.offset = in_offs;
151 sg_in.length = sz; 155 sg_in.length = sz;
152 156
153 sg_out.page = out_page; 157 sg_set_page(&sg_out, out_page);
154 sg_out.offset = out_offs; 158 sg_out.offset = out_offs;
155 sg_out.length = sz; 159 sg_out.length = sz;
156 160
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index 317a790c153b..7276f7d207c2 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -388,6 +388,7 @@ static int __send_request(struct request *req)
388 op = VD_OP_BWRITE; 388 op = VD_OP_BWRITE;
389 } 389 }
390 390
391 sg_init_table(sg, port->ring_cookies);
391 nsg = blk_rq_map_sg(req->q, req, sg); 392 nsg = blk_rq_map_sg(req->q, req, sg);
392 393
393 len = 0; 394 len = 0;
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c
index 402209fec59a..282a69558e8a 100644
--- a/drivers/block/sx8.c
+++ b/drivers/block/sx8.c
@@ -522,6 +522,7 @@ static struct carm_request *carm_get_request(struct carm_host *host)
522 host->n_msgs++; 522 host->n_msgs++;
523 523
524 assert(host->n_msgs <= CARM_MAX_REQ); 524 assert(host->n_msgs <= CARM_MAX_REQ);
525 sg_init_table(crq->sg, CARM_MAX_REQ_SG);
525 return crq; 526 return crq;
526 } 527 }
527 528
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index c57dd2b3a0c8..14143f2c484d 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -25,6 +25,7 @@
25#include <linux/usb_usual.h> 25#include <linux/usb_usual.h>
26#include <linux/blkdev.h> 26#include <linux/blkdev.h>
27#include <linux/timer.h> 27#include <linux/timer.h>
28#include <linux/scatterlist.h>
28#include <scsi/scsi.h> 29#include <scsi/scsi.h>
29 30
30#define DRV_NAME "ub" 31#define DRV_NAME "ub"
@@ -656,6 +657,7 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq)
656 if ((cmd = ub_get_cmd(lun)) == NULL) 657 if ((cmd = ub_get_cmd(lun)) == NULL)
657 return -1; 658 return -1;
658 memset(cmd, 0, sizeof(struct ub_scsi_cmd)); 659 memset(cmd, 0, sizeof(struct ub_scsi_cmd));
660 sg_init_table(cmd->sgv, UB_MAX_REQ_SG);
659 661
660 blkdev_dequeue_request(rq); 662 blkdev_dequeue_request(rq);
661 663
@@ -1309,9 +1311,8 @@ static void ub_data_start(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1309 else 1311 else
1310 pipe = sc->send_bulk_pipe; 1312 pipe = sc->send_bulk_pipe;
1311 sc->last_pipe = pipe; 1313 sc->last_pipe = pipe;
1312 usb_fill_bulk_urb(&sc->work_urb, sc->dev, pipe, 1314 usb_fill_bulk_urb(&sc->work_urb, sc->dev, pipe, sg_virt(sg),
1313 page_address(sg->page) + sg->offset, sg->length, 1315 sg->length, ub_urb_complete, sc);
1314 ub_urb_complete, sc);
1315 sc->work_urb.actual_length = 0; 1316 sc->work_urb.actual_length = 0;
1316 sc->work_urb.error_count = 0; 1317 sc->work_urb.error_count = 0;
1317 sc->work_urb.status = 0; 1318 sc->work_urb.status = 0;
@@ -1427,7 +1428,7 @@ static void ub_state_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1427 scmd->state = UB_CMDST_INIT; 1428 scmd->state = UB_CMDST_INIT;
1428 scmd->nsg = 1; 1429 scmd->nsg = 1;
1429 sg = &scmd->sgv[0]; 1430 sg = &scmd->sgv[0];
1430 sg->page = virt_to_page(sc->top_sense); 1431 sg_set_page(sg, virt_to_page(sc->top_sense));
1431 sg->offset = (unsigned long)sc->top_sense & (PAGE_SIZE-1); 1432 sg->offset = (unsigned long)sc->top_sense & (PAGE_SIZE-1);
1432 sg->length = UB_SENSE_SIZE; 1433 sg->length = UB_SENSE_SIZE;
1433 scmd->len = UB_SENSE_SIZE; 1434 scmd->len = UB_SENSE_SIZE;
@@ -1863,7 +1864,7 @@ static int ub_sync_read_cap(struct ub_dev *sc, struct ub_lun *lun,
1863 cmd->state = UB_CMDST_INIT; 1864 cmd->state = UB_CMDST_INIT;
1864 cmd->nsg = 1; 1865 cmd->nsg = 1;
1865 sg = &cmd->sgv[0]; 1866 sg = &cmd->sgv[0];
1866 sg->page = virt_to_page(p); 1867 sg_set_page(sg, virt_to_page(p));
1867 sg->offset = (unsigned long)p & (PAGE_SIZE-1); 1868 sg->offset = (unsigned long)p & (PAGE_SIZE-1);
1868 sg->length = 8; 1869 sg->length = 8;
1869 cmd->len = 8; 1870 cmd->len = 8;
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
index e824b672e05a..ab5d404faa11 100644
--- a/drivers/block/viodasd.c
+++ b/drivers/block/viodasd.c
@@ -41,6 +41,7 @@
41#include <linux/dma-mapping.h> 41#include <linux/dma-mapping.h>
42#include <linux/completion.h> 42#include <linux/completion.h>
43#include <linux/device.h> 43#include <linux/device.h>
44#include <linux/scatterlist.h>
44 45
45#include <asm/uaccess.h> 46#include <asm/uaccess.h>
46#include <asm/vio.h> 47#include <asm/vio.h>
@@ -270,6 +271,7 @@ static int send_request(struct request *req)
270 d = req->rq_disk->private_data; 271 d = req->rq_disk->private_data;
271 272
272 /* Now build the scatter-gather list */ 273 /* Now build the scatter-gather list */
274 sg_init_table(sg, VIOMAXBLOCKDMA);
273 nsg = blk_rq_map_sg(req->q, req, sg); 275 nsg = blk_rq_map_sg(req->q, req, sg);
274 nsg = dma_map_sg(d->dev, sg, nsg, direction); 276 nsg = dma_map_sg(d->dev, sg, nsg, direction);
275 277