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

Commit ec6c8a8f authored by Colin Cross's avatar Colin Cross Committed by Mitchel Humpherys
Browse files

ion: convert sg_dma_len(sg) to sg->length



ion is always dealing with the allocation and not the mapping,
so it should always be using sg->length and not sg->dma_length.

Change-Id: Id9b07f1196b2bafe04636fa1aa46dfc84d003cf0
Signed-off-by: default avatarColin Cross <ccross@android.com>
Git-commit: c1d3cea1d0b985a78a87675a07c2dab865a416f1
Git-repo: http://android.googlesource.com/kernel/common/


Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent e689cf86
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
		for_each_sg(table->sgl, sg, table->nents, i) {
			struct page *page = sg_page(sg);

			for (j = 0; j < sg_dma_len(sg) / PAGE_SIZE; j++)
			for (j = 0; j < sg->length / PAGE_SIZE; j++)
				buffer->pages[k++] = page++;
		}

+2 −2
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ err:
	sg = table->sgl;
	for (i -= 1; i >= 0; i--) {
		gen_pool_free(chunk_heap->pool, page_to_phys(sg_page(sg)),
			      sg_dma_len(sg));
			      sg->length);
		sg = sg_next(sg);
	}
	sg_free_table(table);
@@ -112,7 +112,7 @@ static void ion_chunk_heap_free(struct ion_buffer *buffer)
		if (ion_buffer_cached(buffer))
			dma_sync_sg_for_device(NULL, sg, 1, DMA_BIDIRECTIONAL);
		gen_pool_free(chunk_heap->pool, page_to_phys(sg_page(sg)),
			      sg_dma_len(sg));
			      sg->length);
	}
	chunk_heap->allocated -= allocated_size;
	sg_free_table(table);
+5 −5
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ void *ion_heap_map_kernel(struct ion_heap *heap,
		pgprot = pgprot_writecombine(PAGE_KERNEL);

	for_each_sg(table->sgl, sg, table->nents, i) {
		int npages_this_entry = PAGE_ALIGN(sg_dma_len(sg)) / PAGE_SIZE;
		int npages_this_entry = PAGE_ALIGN(sg->length) / PAGE_SIZE;
		struct page *page = sg_page(sg);
		BUG_ON(i >= npages);
		for (j = 0; j < npages_this_entry; j++) {
@@ -83,14 +83,14 @@ int ion_heap_map_user(struct ion_heap *heap, struct ion_buffer *buffer,
	for_each_sg(table->sgl, sg, table->nents, i) {
		struct page *page = sg_page(sg);
		unsigned long remainder = vma->vm_end - addr;
		unsigned long len = sg_dma_len(sg);
		unsigned long len = sg->length;

		if (offset >= sg_dma_len(sg)) {
			offset -= sg_dma_len(sg);
		if (offset >= sg->length) {
			offset -= sg->length;
			continue;
		} else if (offset) {
			page += offset / PAGE_SIZE;
			len = sg_dma_len(sg) - offset;
			len = sg->length - offset;
			offset = 0;
		}
		len = min(len, remainder);
+1 −1
Original line number Diff line number Diff line
@@ -210,7 +210,7 @@ void ion_system_heap_free(struct ion_buffer *buffer)

	for_each_sg(table->sgl, sg, table->nents, i)
		free_buffer_page(sys_heap, buffer, sg_page(sg),
				get_order(sg_dma_len(sg)));
				get_order(sg->length));
	sg_free_table(table);
	kfree(table);
}