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 <hyesoo.yu@samsung.com>
Change-Id: I8a9a1715da2c0d7df59a3abe8790614b07f55fe6
(cherry picked from commit 0eb5f60e7dc89ed757b5fc29c488b21cc8a5a846)
Signed-off-by: J. Avila <elavila@google.com>
(cherry picked from commit eb41cb99df24eaa68c936f1b62ae3afca4728014)
Signed-off-by: Will McVicker <willmcvicker@google.com>
(cherry picked from commit 2419380051284d5d00e6c053e69e13e977c41b0e)
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Hyesoo Yu
2020-06-10 17:51:05 +09:00
committed by Greg Kroah-Hartman
parent 34a380a69a
commit cf6f9280f8

View File

@@ -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;