|
25 | 25 | #include <linux/usb_usual.h> |
26 | 26 | #include <linux/blkdev.h> |
27 | 27 | #include <linux/timer.h> |
| 28 | +#include <linux/scatterlist.h> |
28 | 29 | #include <scsi/scsi.h> |
29 | 30 |
|
30 | 31 | #define DRV_NAME "ub" |
@@ -656,6 +657,7 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq) |
656 | 657 | if ((cmd = ub_get_cmd(lun)) == NULL) |
657 | 658 | return -1; |
658 | 659 | memset(cmd, 0, sizeof(struct ub_scsi_cmd)); |
| 660 | + sg_init_table(cmd->sgv, UB_MAX_REQ_SG); |
659 | 661 |
|
660 | 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 | 1311 | else |
1310 | 1312 | pipe = sc->send_bulk_pipe; |
1311 | 1313 | sc->last_pipe = pipe; |
1312 | | - usb_fill_bulk_urb(&sc->work_urb, sc->dev, pipe, |
1313 | | - page_address(sg->page) + sg->offset, sg->length, |
1314 | | - ub_urb_complete, sc); |
| 1314 | + usb_fill_bulk_urb(&sc->work_urb, sc->dev, pipe, sg_virt(sg), |
| 1315 | + sg->length, ub_urb_complete, sc); |
1315 | 1316 | sc->work_urb.actual_length = 0; |
1316 | 1317 | sc->work_urb.error_count = 0; |
1317 | 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 | 1428 | scmd->state = UB_CMDST_INIT; |
1428 | 1429 | scmd->nsg = 1; |
1429 | 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 | 1432 | sg->offset = (unsigned long)sc->top_sense & (PAGE_SIZE-1); |
1432 | 1433 | sg->length = UB_SENSE_SIZE; |
1433 | 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 | 1864 | cmd->state = UB_CMDST_INIT; |
1864 | 1865 | cmd->nsg = 1; |
1865 | 1866 | sg = &cmd->sgv[0]; |
1866 | | - sg->page = virt_to_page(p); |
| 1867 | + sg_set_page(sg, virt_to_page(p)); |
1867 | 1868 | sg->offset = (unsigned long)p & (PAGE_SIZE-1); |
1868 | 1869 | sg->length = 8; |
1869 | 1870 | cmd->len = 8; |
|
0 commit comments