Skip to contentSkip to conversation

patch "Revert "staging: ion: Fix ion_cma_heap allocations"" added to staging-linus

PATCH [email protected] 1 participant 1 message Dec 15, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

Revert "staging: ion: Fix ion_cma_heap allocations"

to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

Quoted 1 line

From 3d2a0c5ff02d57ab7b4f16a6782a66765d930b7d Mon Sep 17 00:00:00 2001

From: Greg Kroah-Hartman <[email protected]>
Date: Fri, 15 Dec 2017 19:36:24 +0100
Subject: Revert "staging: ion: Fix ion_cma_heap allocations"

This reverts commit d98e6dbf42f73101128885a1e0ae672cd92b2e1a as it broke the build on some configurations. It's not really obvious why those configurataions/platforms do not have all of the cma #defines availble, which means something larger is going wrong here.

Cc Laura Abbott <[email protected]>
Cc Sumit Semwal <[email protected]>
Cc Benjamin Gaignard <[email protected]>
Cc Archit Taneja <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Dmitry Shmidt <[email protected]>
Cc Todd Kjos <[email protected]>
Cc Amit Pundir <[email protected]>
Cc stable <[email protected]>
Cc John Stultz <[email protected]>
---
 drivers/staging/android/ion/ion_cma_heap.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/staging/android/ion/ion_cma_heap.c +4 -11
index 86196ffd2faf..dd5545d9990a 100644
@@ -39,15 +39,9 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 	struct ion_cma_heap *cma_heap = to_cma_heap(heap);
 	struct sg_table *table;
 	struct page *pages;
-	unsigned long size = PAGE_ALIGN(len);
-	unsigned long nr_pages = size >> PAGE_SHIFT;
-	unsigned long align = get_order(size);
 	int ret;
 
-	if (align > CONFIG_CMA_ALIGNMENT)
-		align = CONFIG_CMA_ALIGNMENT;
-
-	pages = cma_alloc(cma_heap->cma, nr_pages, align, GFP_KERNEL);
+	pages = cma_alloc(cma_heap->cma, len, 0, GFP_KERNEL);
 	if (!pages)
 		return -ENOMEM;
 
@@ -59,7 +53,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 	if (ret)
 		goto free_mem;
 
-	sg_set_page(table->sgl, pages, size, 0);
+	sg_set_page(table->sgl, pages, len, 0);
 
 	buffer->priv_virt = pages;
 	buffer->sg_table = table;
@@ -68,7 +62,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 free_mem:
 	kfree(table);
 err:
-	cma_release(cma_heap->cma, pages, nr_pages);
+	cma_release(cma_heap->cma, pages, buffer->size);
 	return -ENOMEM;
 }
 
@@ -76,10 +70,9 @@ 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;
-	unsigned long nr_pages = PAGE_ALIGN(buffer->size) >> PAGE_SHIFT;
 
 	/* release memory */
-	cma_release(cma_heap->cma, pages, nr_pages);
+	cma_release(cma_heap->cma, pages, buffer->size);
 	/* release sg table */
 	sg_free_table(buffer->sg_table);
 	kfree(buffer->sg_table);
Signature · 1 line
2.15.1