mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-11 16:29:05 +00:00
[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>
This commit is contained in:
parent
a8f23b0353
commit
a71fa1fc43
@ -323,16 +323,6 @@ static void set_srp_direction(struct scsi_cmnd *cmd,
|
|||||||
srp_cmd->buf_fmt = fmt;
|
srp_cmd->buf_fmt = fmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unmap_sg_list(int num_entries,
|
|
||||||
struct device *dev,
|
|
||||||
struct srp_direct_buf *md)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < num_entries; ++i)
|
|
||||||
dma_unmap_single(dev, md[i].va, md[i].len, DMA_BIDIRECTIONAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* unmap_cmd_data: - Unmap data pointed in srp_cmd based on the format
|
* unmap_cmd_data: - Unmap data pointed in srp_cmd based on the format
|
||||||
* @cmd: srp_cmd whose additional_data member will be unmapped
|
* @cmd: srp_cmd whose additional_data member will be unmapped
|
||||||
@ -350,24 +340,9 @@ static void unmap_cmd_data(struct srp_cmd *cmd,
|
|||||||
|
|
||||||
if (out_fmt == SRP_NO_DATA_DESC && in_fmt == SRP_NO_DATA_DESC)
|
if (out_fmt == SRP_NO_DATA_DESC && in_fmt == SRP_NO_DATA_DESC)
|
||||||
return;
|
return;
|
||||||
else if (out_fmt == SRP_DATA_DESC_DIRECT ||
|
|
||||||
in_fmt == SRP_DATA_DESC_DIRECT) {
|
|
||||||
struct srp_direct_buf *data =
|
|
||||||
(struct srp_direct_buf *) cmd->add_data;
|
|
||||||
dma_unmap_single(dev, data->va, data->len, DMA_BIDIRECTIONAL);
|
|
||||||
} else {
|
|
||||||
struct srp_indirect_buf *indirect =
|
|
||||||
(struct srp_indirect_buf *) cmd->add_data;
|
|
||||||
int num_mapped = indirect->table_desc.len /
|
|
||||||
sizeof(struct srp_direct_buf);
|
|
||||||
|
|
||||||
if (num_mapped <= MAX_INDIRECT_BUFS) {
|
if (evt_struct->cmnd)
|
||||||
unmap_sg_list(num_mapped, dev, &indirect->desc_list[0]);
|
scsi_dma_unmap(evt_struct->cmnd);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
unmap_sg_list(num_mapped, dev, evt_struct->ext_list);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int map_sg_list(struct scsi_cmnd *cmd, int nseg,
|
static int map_sg_list(struct scsi_cmnd *cmd, int nseg,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user