aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/ub.c
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/ub.c
parent78c2f0b8c285c5305b3e67b0595200541e15eb43 (diff)
[SG] Update drivers to use sg helpers
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block/ub.c')
-rw-r--r--drivers/block/ub.c11
1 files changed, 6 insertions, 5 deletions
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;