From 88f3f8241476a2a96dbb10c7b8c3a1063a9334c0 Mon Sep 17 00:00:00 2001 From: Mark Yao Date: Fri, 26 Jun 2015 08:42:30 +0800 Subject: [PATCH] staging: ion: add dma_map_sg/dma_umap_sg to map_dma_buf Change-Id: Ibb1da3afd35a4411f096e8cbd7a17d35fc216cba Signed-off-by: Mark Yao --- drivers/staging/android/ion/ion.c | 5 +++++ 1 file changed, 5 insertions(+) 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, -- 2.34.1