From: Mark Yao Date: Fri, 26 Jun 2015 00:42:30 +0000 (+0800) Subject: staging: ion: add dma_map_sg/dma_umap_sg to map_dma_buf X-Git-Tag: firefly_0821_release~249 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=88f3f8241476a2a96dbb10c7b8c3a1063a9334c0;p=firefly-linux-kernel-4.4.55.git staging: ion: add dma_map_sg/dma_umap_sg to map_dma_buf Change-Id: Ibb1da3afd35a4411f096e8cbd7a17d35fc216cba Signed-off-by: Mark Yao --- diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 18c2c7c3deb8..13c0972669c0 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -1180,6 +1180,10 @@ static struct sg_table *ion_map_dma_buf(struct dma_buf_attachment *attachment, struct ion_buffer *buffer = dmabuf->priv; ion_buffer_sync_for_device(buffer, attachment->dev, direction); + if (!dma_map_sg(attachment->dev, buffer->sg_table->sgl, + buffer->sg_table->nents, direction)) + return ERR_PTR(-ENOMEM); + return buffer->sg_table; } @@ -1187,6 +1191,7 @@ static void ion_unmap_dma_buf(struct dma_buf_attachment *attachment, struct sg_table *table, enum dma_data_direction direction) { + dma_unmap_sg(attachment->dev, table->sgl, table->nents, direction); } void ion_pages_sync_for_device(struct device *dev, struct page *page,