aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsrp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libsrp.c')
-rw-r--r--drivers/scsi/libsrp.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/scsi/libsrp.c b/drivers/scsi/libsrp.c
index 2ad0a27dbaab..5cff0204227d 100644
--- a/drivers/scsi/libsrp.c
+++ b/drivers/scsi/libsrp.c
@@ -192,18 +192,18 @@ static int srp_direct_data(struct scsi_cmnd *sc, struct srp_direct_buf *md,
192 192
193 if (dma_map) { 193 if (dma_map) {
194 iue = (struct iu_entry *) sc->SCp.ptr; 194 iue = (struct iu_entry *) sc->SCp.ptr;
195 sg = sc->request_buffer; 195 sg = scsi_sglist(sc);
196 196
197 dprintk("%p %u %u %d\n", iue, sc->request_bufflen, 197 dprintk("%p %u %u %d\n", iue, scsi_bufflen(sc),
198 md->len, sc->use_sg); 198 md->len, scsi_sg_count(sc));
199 199
200 nsg = dma_map_sg(iue->target->dev, sg, sc->use_sg, 200 nsg = dma_map_sg(iue->target->dev, sg, scsi_sg_count(sc),
201 DMA_BIDIRECTIONAL); 201 DMA_BIDIRECTIONAL);
202 if (!nsg) { 202 if (!nsg) {
203 printk("fail to map %p %d\n", iue, sc->use_sg); 203 printk("fail to map %p %d\n", iue, scsi_sg_count(sc));
204 return 0; 204 return 0;
205 } 205 }
206 len = min(sc->request_bufflen, md->len); 206 len = min(scsi_bufflen(sc), md->len);
207 } else 207 } else
208 len = md->len; 208 len = md->len;
209 209
@@ -229,10 +229,10 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd,
229 229
230 if (dma_map || ext_desc) { 230 if (dma_map || ext_desc) {
231 iue = (struct iu_entry *) sc->SCp.ptr; 231 iue = (struct iu_entry *) sc->SCp.ptr;
232 sg = sc->request_buffer; 232 sg = scsi_sglist(sc);
233 233
234 dprintk("%p %u %u %d %d\n", 234 dprintk("%p %u %u %d %d\n",
235 iue, sc->request_bufflen, id->len, 235 iue, scsi_bufflen(sc), id->len,
236 cmd->data_in_desc_cnt, cmd->data_out_desc_cnt); 236 cmd->data_in_desc_cnt, cmd->data_out_desc_cnt);
237 } 237 }
238 238
@@ -268,13 +268,14 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd,
268 268
269rdma: 269rdma:
270 if (dma_map) { 270 if (dma_map) {
271 nsg = dma_map_sg(iue->target->dev, sg, sc->use_sg, DMA_BIDIRECTIONAL); 271 nsg = dma_map_sg(iue->target->dev, sg, scsi_sg_count(sc),
272 DMA_BIDIRECTIONAL);
272 if (!nsg) { 273 if (!nsg) {
273 eprintk("fail to map %p %d\n", iue, sc->use_sg); 274 eprintk("fail to map %p %d\n", iue, scsi_sg_count(sc));
274 err = -EIO; 275 err = -EIO;
275 goto free_mem; 276 goto free_mem;
276 } 277 }
277 len = min(sc->request_bufflen, id->len); 278 len = min(scsi_bufflen(sc), id->len);
278 } else 279 } else
279 len = id->len; 280 len = id->len;
280 281