diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2010-04-02 02:50:24 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-04-11 14:38:54 -0400 |
commit | a71fa1fc43a29133f13ae6ada1a389ca298c0934 (patch) | |
tree | 64cb549ef371f683a5b3d3373a8b8e84b9326b73 /drivers/scsi | |
parent | a8f23b03535359c5afeb77d937b89b8a4d87b2b2 (diff) |
[SCSI] ibmvscsi: fix DMA API misuse
ibmvscsi uses dma_unmap_single() for buffers mapped via
dma_map_sg(). It works however it's the API violation. The DMA debug
facility complains about it:
http://marc.info/?l=linux-scsi&m=127018555013151&w=2
Reported-by: Sachin Sant <sachinp@in.ibm.com>
Tested-by: Sachin Sant <sachinp@in.ibm.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/ibmvscsi/ibmvscsi.c | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index ff5ec5ac1fb5..88bad0e81bdd 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -323,16 +323,6 @@ static void set_srp_direction(struct scsi_cmnd *cmd, | |||
323 | srp_cmd->buf_fmt = fmt; | 323 | srp_cmd->buf_fmt = fmt; |
324 | } | 324 | } |
325 | 325 | ||
326 | static void unmap_sg_list(int num_entries, | ||
327 | struct device *dev, | ||
328 | struct srp_direct_buf *md) | ||
329 | { | ||
330 | int i; | ||
331 | |||
332 | for (i = 0; i < num_entries; ++i) | ||
333 | dma_unmap_single(dev, md[i].va, md[i].len, DMA_BIDIRECTIONAL); | ||
334 | } | ||
335 | |||
336 | /** | 326 | /** |
337 | * unmap_cmd_data: - Unmap data pointed in srp_cmd based on the format | 327 | * unmap_cmd_data: - Unmap data pointed in srp_cmd based on the format |
338 | * @cmd: srp_cmd whose additional_data member will be unmapped | 328 | * @cmd: srp_cmd whose additional_data member will be unmapped |
@@ -350,24 +340,9 @@ static void unmap_cmd_data(struct srp_cmd *cmd, | |||
350 | 340 | ||
351 | if (out_fmt == SRP_NO_DATA_DESC && in_fmt == SRP_NO_DATA_DESC) | 341 | if (out_fmt == SRP_NO_DATA_DESC && in_fmt == SRP_NO_DATA_DESC) |
352 | return; | 342 | return; |
353 | else if (out_fmt == SRP_DATA_DESC_DIRECT || | ||
354 | in_fmt == SRP_DATA_DESC_DIRECT) { | ||
355 | struct srp_direct_buf *data = | ||
356 | (struct srp_direct_buf *) cmd->add_data; | ||
357 | dma_unmap_single(dev, data->va, data->len, DMA_BIDIRECTIONAL); | ||
358 | } else { | ||
359 | struct srp_indirect_buf *indirect = | ||
360 | (struct srp_indirect_buf *) cmd->add_data; | ||
361 | int num_mapped = indirect->table_desc.len / | ||
362 | sizeof(struct srp_direct_buf); | ||
363 | 343 | ||
364 | if (num_mapped <= MAX_INDIRECT_BUFS) { | 344 | if (evt_struct->cmnd) |
365 | unmap_sg_list(num_mapped, dev, &indirect->desc_list[0]); | 345 | scsi_dma_unmap(evt_struct->cmnd); |
366 | return; | ||
367 | } | ||
368 | |||
369 | unmap_sg_list(num_mapped, dev, evt_struct->ext_list); | ||
370 | } | ||
371 | } | 346 | } |
372 | 347 | ||
373 | static int map_sg_list(struct scsi_cmnd *cmd, int nseg, | 348 | static int map_sg_list(struct scsi_cmnd *cmd, int nseg, |