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. >From 3d2a0c5ff02d57ab7b4f16a6782a66765d930b7d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> 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. Reported-by: kbuild test robot <fengguang.wu@xxxxxxxxx> Cc: Laura Abbott <labbott@xxxxxxxxxx> Cc: Sumit Semwal <sumit.semwal@xxxxxxxxxx> Cc: Benjamin Gaignard <benjamin.gaignard@xxxxxxxxxx> Cc: Archit Taneja <architt@xxxxxxxxxxxxxx> Cc: Daniel Vetter <daniel@xxxxxxxx> Cc: Dmitry Shmidt <dimitrysh@xxxxxxxxxx> Cc: Todd Kjos <tkjos@xxxxxxxxxx> Cc: Amit Pundir <amit.pundir@xxxxxxxxxx> Cc: stable <stable@xxxxxxxxxxxxxxx> Cc: John Stultz <john.stultz@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/android/ion/ion_cma_heap.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c index 86196ffd2faf..dd5545d9990a 100644 --- a/drivers/staging/android/ion/ion_cma_heap.c +++ b/drivers/staging/android/ion/ion_cma_heap.c @@ -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); -- 2.15.1