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

Commit 5dbd5d63 authored by Isaac J. Manjarres's avatar Isaac J. Manjarres
Browse files

ion: Derive CMA buffer struct page without using priv_virt



The priv_virt field can be useful for storing other meta-data
associated with a buffer besides the pointer to the struct page
associated with the buffer. Additionally, the struct page
pointer can be derived by looking at the sg-list structure for
the buffer. Thus, use the sg-list structure to derive the struct
page pointer for a CMA buffer, instead of the priv_virt field.

Change-Id: I1740ac56c4268ece315144fb2c3d8f48d9608c41
Signed-off-by: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent 7718d1b4
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -94,8 +94,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
		goto free_mem;

	sg_set_page(table->sgl, pages, size, 0);

	buffer->priv_virt = pages;
;
	buffer->sg_table = table;
	ion_prepare_sgl_for_force_dma_sync(buffer->sg_table);
	return 0;
@@ -110,7 +109,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
static void ion_cma_free(struct ion_buffer *buffer)
{
	struct ion_cma_heap *cma_heap = to_cma_heap(buffer->heap);
	struct page *pages = buffer->priv_virt;
	struct page *pages = sg_page(buffer->sg_table->sgl);
	unsigned long nr_pages = PAGE_ALIGN(buffer->size) >> PAGE_SHIFT;

	/* release memory */