aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-10-24 05:20:47 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-10-24 05:20:47 -0400
commit642f149031d70415d9318b919d50b71e4724adbd (patch)
treee792ad29dedffc6756d55e9d63e18ada35515b4b /drivers/block
parentbd6dee6f30a0f6943df190b387b5f8fe98a848f3 (diff)
SG: Change sg_set_page() to take length and offset argument
Most drivers need to set length and offset as well, so may as well fold those three lines into one. Add sg_assign_page() for those two locations that only needed to set the page, where the offset/length is set outside of the function context. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/cryptoloop.c9
-rw-r--r--drivers/block/ub.c9
2 files changed, 5 insertions, 13 deletions
diff --git a/drivers/block/cryptoloop.c b/drivers/block/cryptoloop.c
index 1b58b010797f..241167878edf 100644
--- a/drivers/block/cryptoloop.c
+++ b/drivers/block/cryptoloop.c
@@ -150,13 +150,8 @@ cryptoloop_transfer(struct loop_device *lo, int cmd,
150 u32 iv[4] = { 0, }; 150 u32 iv[4] = { 0, };
151 iv[0] = cpu_to_le32(IV & 0xffffffff); 151 iv[0] = cpu_to_le32(IV & 0xffffffff);
152 152
153 sg_set_page(&sg_in, in_page); 153 sg_set_page(&sg_in, in_page, sz, in_offs);
154 sg_in.offset = in_offs; 154 sg_set_page(&sg_out, out_page, sz, out_offs);
155 sg_in.length = sz;
156
157 sg_set_page(&sg_out, out_page);
158 sg_out.offset = out_offs;
159 sg_out.length = sz;
160 155
161 desc.info = iv; 156 desc.info = iv;
162 err = encdecfunc(&desc, &sg_out, &sg_in, sz); 157 err = encdecfunc(&desc, &sg_out, &sg_in, sz);
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 14143f2c484d..5e740e14ab35 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -1428,9 +1428,8 @@ static void ub_state_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1428 scmd->state = UB_CMDST_INIT; 1428 scmd->state = UB_CMDST_INIT;
1429 scmd->nsg = 1; 1429 scmd->nsg = 1;
1430 sg = &scmd->sgv[0]; 1430 sg = &scmd->sgv[0];
1431 sg_set_page(sg, virt_to_page(sc->top_sense)); 1431 sg_set_page(sg, virt_to_page(sc->top_sense), UB_SENSE_SIZE,
1432 sg->offset = (unsigned long)sc->top_sense & (PAGE_SIZE-1); 1432 (unsigned long)sc->top_sense & (PAGE_SIZE-1));
1433 sg->length = UB_SENSE_SIZE;
1434 scmd->len = UB_SENSE_SIZE; 1433 scmd->len = UB_SENSE_SIZE;
1435 scmd->lun = cmd->lun; 1434 scmd->lun = cmd->lun;
1436 scmd->done = ub_top_sense_done; 1435 scmd->done = ub_top_sense_done;
@@ -1864,9 +1863,7 @@ static int ub_sync_read_cap(struct ub_dev *sc, struct ub_lun *lun,
1864 cmd->state = UB_CMDST_INIT; 1863 cmd->state = UB_CMDST_INIT;
1865 cmd->nsg = 1; 1864 cmd->nsg = 1;
1866 sg = &cmd->sgv[0]; 1865 sg = &cmd->sgv[0];
1867 sg_set_page(sg, virt_to_page(p)); 1866 sg_set_page(sg, virt_to_page(p), 8, (unsigned long)p & (PAGE_SIZE-1));
1868 sg->offset = (unsigned long)p & (PAGE_SIZE-1);
1869 sg->length = 8;
1870 cmd->len = 8; 1867 cmd->len = 8;
1871 cmd->lun = lun; 1868 cmd->lun = lun;
1872 cmd->done = ub_probe_done; 1869 cmd->done = ub_probe_done;