Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8eb89f27 authored by Sandeep Patil's avatar Sandeep Patil
Browse files

ANDROID: staging: ion: Remove unnecessary ion heap ops



The heap operations are redundant now that we have default
dma_buf operations. So, remove them.

Bug: 133508579
Bug: 140290587
Test: ion-unit-tests

Change-Id: I8f87c22896e128f48ed222421cabc23ab238ff69
Signed-off-by: default avatarSandeep Patil <sspatil@google.com>
parent 296ba130
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -95,9 +95,6 @@ static void ion_cma_free(struct ion_buffer *buffer)
static struct ion_heap_ops ion_cma_ops = {
	.allocate = ion_cma_allocate,
	.free = ion_cma_free,
	.map_user = ion_heap_map_user,
	.map_kernel = ion_heap_map_kernel,
	.unmap_kernel = ion_heap_unmap_kernel,
};

static struct ion_heap *__ion_cma_heap_create(struct cma *cma)
+0 −3
Original line number Diff line number Diff line
@@ -77,9 +77,6 @@ static void ion_system_contig_heap_free(struct ion_buffer *buffer)
static struct ion_heap_ops kmalloc_ops = {
	.allocate = ion_system_contig_heap_allocate,
	.free = ion_system_contig_heap_free,
	.map_kernel = ion_heap_map_kernel,
	.unmap_kernel = ion_heap_unmap_kernel,
	.map_user = ion_heap_map_user,
};

static struct ion_heap contig_heap = {
+0 −3
Original line number Diff line number Diff line
@@ -241,9 +241,6 @@ static int ion_system_heap_create_pools(struct ion_page_pool **pools)
static struct ion_heap_ops system_heap_ops = {
	.allocate = ion_system_heap_allocate,
	.free = ion_system_heap_free,
	.map_kernel = ion_heap_map_kernel,
	.unmap_kernel = ion_heap_unmap_kernel,
	.map_user = ion_heap_map_user,
	.shrink = ion_system_heap_shrink,
};

+3 −3
Original line number Diff line number Diff line
@@ -201,7 +201,7 @@ void ion_buffer_release(struct ion_buffer *buffer)
	if (buffer->kmap_cnt > 0) {
		pr_warn_once("%s: buffer still mapped in the kernel\n",
			     __func__);
		buffer->heap->ops->unmap_kernel(buffer->heap, buffer);
		ion_heap_unmap_kernel(buffer->heap, buffer);
	}
	buffer->heap->ops->free(buffer);
	spin_lock(&buffer->heap->stat_lock);
@@ -245,7 +245,7 @@ void *ion_buffer_kmap_get(struct ion_buffer *buffer)
		buffer->kmap_cnt++;
		return buffer->vaddr;
	}
	vaddr = buffer->heap->ops->map_kernel(buffer->heap, buffer);
	vaddr = ion_heap_map_kernel(buffer->heap, buffer);
	if (WARN_ONCE(!vaddr,
		      "heap->ops->map_kernel should return ERR_PTR on error"))
		return ERR_PTR(-EINVAL);
@@ -260,7 +260,7 @@ void ion_buffer_kmap_put(struct ion_buffer *buffer)
{
	buffer->kmap_cnt--;
	if (!buffer->kmap_cnt) {
		buffer->heap->ops->unmap_kernel(buffer->heap, buffer);
		ion_heap_unmap_kernel(buffer->heap, buffer);
		buffer->vaddr = NULL;
	}
}
+9 −16
Original line number Diff line number Diff line
@@ -154,19 +154,16 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,

	/*
	 * TODO: Move this elsewhere because we don't always need a vaddr
	 * FIXME: Why do we need a vaddr here?
	 */
	ret = 0;
	if (heap->ops->map_kernel) {
	mutex_lock(&buffer->lock);
	vaddr = ion_buffer_kmap_get(buffer);
	if (IS_ERR(vaddr)) {
		ret = PTR_ERR(vaddr);
		goto unlock;
	}
		mutex_unlock(&buffer->lock);
	}

	mutex_lock(&buffer->lock);
	list_for_each_entry(a, &buffer->attachments, list) {
		dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
				    direction);
@@ -206,13 +203,9 @@ static int ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf,
	if (heap->buf_ops.end_cpu_access)
		return heap->buf_ops.end_cpu_access(dmabuf, direction);

	if (heap->ops->map_kernel) {
	mutex_lock(&buffer->lock);
		ion_buffer_kmap_put(buffer);
		mutex_unlock(&buffer->lock);
	}

	mutex_lock(&buffer->lock);
	ion_buffer_kmap_put(buffer);
	list_for_each_entry(a, &buffer->attachments, list) {
		dma_sync_sg_for_device(a->dev, a->table->sgl, a->table->nents,
				       direction);
@@ -249,7 +242,7 @@ static void *ion_dma_buf_map(struct dma_buf *dmabuf, unsigned long offset)
	if (heap->buf_ops.map)
		return heap->buf_ops.map(dmabuf, offset);

	return buffer->vaddr + offset * PAGE_SIZE;
	return ion_buffer_kmap_get(buffer) + offset * PAGE_SIZE;
}

static int ion_dma_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
Loading