From cf6f9280f8bd8755483f5c8a2f4200ce60355d6c Mon Sep 17 00:00:00 2001 From: Hyesoo Yu Date: Wed, 10 Jun 2020 17:51:05 +0900 Subject: [PATCH] ANDROID: staging: ion: remove kmap from begin[end]_cpu_access The begin[end]_cpu_access handles cache coherency. However the kmap is always called here and it just makes unnecessary overhead of kmap. We don't need to call kmap on begin[end]_cpu_access because ION no longer supports dma_buf_kmap callback on ion dma, so remove it. Bug: 158635261 Bug: 170264063 Signed-off-by: Hyesoo YU Change-Id: I8a9a1715da2c0d7df59a3abe8790614b07f55fe6 (cherry picked from commit 0eb5f60e7dc89ed757b5fc29c488b21cc8a5a846) Signed-off-by: J. Avila (cherry picked from commit eb41cb99df24eaa68c936f1b62ae3afca4728014) Signed-off-by: Will McVicker (cherry picked from commit 2419380051284d5d00e6c053e69e13e977c41b0e) Signed-off-by: Will McVicker Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/ion_dma_buf.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/staging/android/ion/ion_dma_buf.c b/drivers/staging/android/ion/ion_dma_buf.c index 3cd40f9ac48b..8b6741696b08 100644 --- a/drivers/staging/android/ion/ion_dma_buf.c +++ b/drivers/staging/android/ion/ion_dma_buf.c @@ -165,23 +165,11 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, struct ion_heap *heap = buffer->heap; void *vaddr; struct ion_dma_buf_attachment *a; - int ret; if (heap->buf_ops.begin_cpu_access) return heap->buf_ops.begin_cpu_access(dmabuf, direction); - /* - * TODO: Move this elsewhere because we don't always need a vaddr - * FIXME: Why do we need a vaddr here? - */ - ret = 0; mutex_lock(&buffer->lock); - vaddr = ion_buffer_kmap_get(buffer); - if (IS_ERR(vaddr)) { - ret = PTR_ERR(vaddr); - goto unlock; - } - if (!(buffer->flags & ION_FLAG_CACHED)) goto unlock; @@ -194,7 +182,7 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, unlock: mutex_unlock(&buffer->lock); - return ret; + return 0; } static int @@ -227,9 +215,6 @@ static int ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf, return heap->buf_ops.end_cpu_access(dmabuf, direction); mutex_lock(&buffer->lock); - - ion_buffer_kmap_put(buffer); - if (!(buffer->flags & ION_FLAG_CACHED)) goto unlock;