ANDROID: 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

Signed-off-by: Hyesoo YU <hyesoo.yu@samsung.com>
Change-Id: I8a9a1715da2c0d7df59a3abe8790614b07f55fe6
This commit is contained in:
Hyesoo Yu 2020-06-10 17:51:05 +09:00 • committed by Todd Kjos
commit 0eb5f60e7d

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;