Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1324919 > unrolled thread

[PATCH] staging: android: ion: use the manged version of DMA memory allocation

Started by"Gujulan Elango, Hari Prasath (H.)" <hgujulan@visteon.com>
First post2016-02-03 06:30 +0100
Last post2016-02-03 07:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: android: ion: use the manged version of DMA memory  allocation "Gujulan Elango, Hari Prasath (H.)" <hgujulan@visteon.com> - 2016-02-03 06:30 +0100
    Re: [PATCH] staging: android: ion: use the manged version of DMA  memory allocation kbuild test robot <lkp@intel.com> - 2016-02-03 07:00 +0100

#1324919 — [PATCH] staging: android: ion: use the manged version of DMA memory allocation

From"Gujulan Elango, Hari Prasath (H.)" <hgujulan@visteon.com>
Date2016-02-03 06:30 +0100
Subject[PATCH] staging: android: ion: use the manged version of DMA memory allocation
Message-ID<qXYaS-63Z-5@gated-at.bofh.it>
From: Hari Prasath Gujulan Elango <hgujulan@visteon.com>

Use the managed version of the dma_alloc_coherent() i.e. the
dmam_alloc_coherent() & accordingly cleanup the error handling
part.Also,remove the references to dma_free_coherent.

Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com>
---
 drivers/staging/android/ion/ion_cma_heap.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c
index a3446da..88375d9 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -61,7 +61,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 	if (!info)
 		return ION_CMA_ALLOCATE_FAILED;
 
-	info->cpu_addr = dma_alloc_coherent(dev, len, &(info->handle),
+	info->cpu_addr = dmam_alloc_coherent(dev, len, &(info->handle),
 						GFP_HIGHUSER | __GFP_ZERO);
 
 	if (!info->cpu_addr) {
@@ -71,7 +71,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 
 	info->table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
 	if (!info->table)
-		goto free_mem;
+		goto err;
 
 	if (dma_get_sgtable(dev, info->table, info->cpu_addr, info->handle,
 			    len))
@@ -83,8 +83,6 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
 
 free_table:
 	kfree(info->table);
-free_mem:
-	dma_free_coherent(dev, len, info->cpu_addr, info->handle);
 err:
 	kfree(info);
 	return ION_CMA_ALLOCATE_FAILED;
@@ -96,9 +94,6 @@ static void ion_cma_free(struct ion_buffer *buffer)
 	struct device *dev = cma_heap->dev;
 	struct ion_cma_buffer_info *info = buffer->priv_virt;
 
-	dev_dbg(dev, "Release buffer %p\n", buffer);
-	/* release memory */
-	dma_free_coherent(dev, buffer->size, info->cpu_addr, info->handle);
 	/* release sg table */
 	sg_free_table(info->table);
 	kfree(info->table);
-- 
1.9.1

[toc] | [next] | [standalone]


#1324938 — Re: [PATCH] staging: android: ion: use the manged version of DMA memory allocation

Fromkbuild test robot <lkp@intel.com>
Date2016-02-03 07:00 +0100
SubjectRe: [PATCH] staging: android: ion: use the manged version of DMA memory allocation
Message-ID<qXYDU-6g2-1@gated-at.bofh.it>
In reply to#1324919

[Multipart message — attachments visible in raw view] — view raw

Hi Hari,

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.5-rc2 next-20160202]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Gujulan-Elango-Hari-Prasath-H/staging-android-ion-use-the-manged-version-of-DMA-memory-allocation/20160203-132744
config: x86_64-randconfig-x009-201605 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/staging/android/ion/ion_cma_heap.c: In function 'ion_cma_free':
>> drivers/staging/android/ion/ion_cma_heap.c:94:17: warning: unused variable 'dev' [-Wunused-variable]
     struct device *dev = cma_heap->dev;
                    ^

vim +/dev +94 drivers/staging/android/ion/ion_cma_heap.c

349c9e13 Benjamin Gaignard 2013-12-13   78  		goto free_table;
349c9e13 Benjamin Gaignard 2013-12-13   79  	/* keep this for memory release */
349c9e13 Benjamin Gaignard 2013-12-13   80  	buffer->priv_virt = info;
349c9e13 Benjamin Gaignard 2013-12-13   81  	dev_dbg(dev, "Allocate buffer %p\n", buffer);
349c9e13 Benjamin Gaignard 2013-12-13   82  	return 0;
349c9e13 Benjamin Gaignard 2013-12-13   83  
349c9e13 Benjamin Gaignard 2013-12-13   84  free_table:
349c9e13 Benjamin Gaignard 2013-12-13   85  	kfree(info->table);
349c9e13 Benjamin Gaignard 2013-12-13   86  err:
349c9e13 Benjamin Gaignard 2013-12-13   87  	kfree(info);
349c9e13 Benjamin Gaignard 2013-12-13   88  	return ION_CMA_ALLOCATE_FAILED;
349c9e13 Benjamin Gaignard 2013-12-13   89  }
349c9e13 Benjamin Gaignard 2013-12-13   90  
349c9e13 Benjamin Gaignard 2013-12-13   91  static void ion_cma_free(struct ion_buffer *buffer)
349c9e13 Benjamin Gaignard 2013-12-13   92  {
349c9e13 Benjamin Gaignard 2013-12-13   93  	struct ion_cma_heap *cma_heap = to_cma_heap(buffer->heap);
349c9e13 Benjamin Gaignard 2013-12-13  @94  	struct device *dev = cma_heap->dev;
349c9e13 Benjamin Gaignard 2013-12-13   95  	struct ion_cma_buffer_info *info = buffer->priv_virt;
349c9e13 Benjamin Gaignard 2013-12-13   96  
349c9e13 Benjamin Gaignard 2013-12-13   97  	/* release sg table */
349c9e13 Benjamin Gaignard 2013-12-13   98  	sg_free_table(info->table);
349c9e13 Benjamin Gaignard 2013-12-13   99  	kfree(info->table);
349c9e13 Benjamin Gaignard 2013-12-13  100  	kfree(info);
349c9e13 Benjamin Gaignard 2013-12-13  101  }
349c9e13 Benjamin Gaignard 2013-12-13  102  

:::::: The code at line 94 was first introduced by commit
:::::: 349c9e13855109df99c5205a4e8d53d9fa169490 gpu: ion: add CMA heap

:::::: TO: Benjamin Gaignard <benjamin.gaignard@linaro.org>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web