rk: ion: assign sg's dma_length in ion allocation if CONFIG_NEED_SG_DMA_LENGTH is set

(cherry picked from commit c85ce1ade5)

Signed-off-by: CMY <cmy@rock-chips.com>
This commit is contained in:
CMY 2015-02-14 18:05:01 +08:00
parent f5c3bef8c6
commit dcd1c0a410

View File

@ -265,8 +265,12 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
allocation via dma_map_sg. The implicit contract here is that
memory comming from the heaps is ready for dma, ie if it has a
cached mapping that mapping has been invalidated */
for_each_sg(buffer->sg_table->sgl, sg, buffer->sg_table->nents, i)
for_each_sg(buffer->sg_table->sgl, sg, buffer->sg_table->nents, i) {
sg_dma_address(sg) = sg_phys(sg);
#ifdef CONFIG_NEED_SG_DMA_LENGTH
sg_dma_len(sg) = sg->length;
#endif
}
mutex_lock(&dev->buffer_lock);
ion_buffer_add(dev, buffer);
mutex_unlock(&dev->buffer_lock);