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


Groups > linux.kernel > #1324919

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

Path csiph.com!feeder.erje.net!2.us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From "Gujulan Elango, Hari Prasath (H.)" <hgujulan@visteon.com>
Newsgroups linux.kernel
Subject [PATCH] staging: android: ion: use the manged version of DMA memory allocation
Date Wed, 03 Feb 2016 06:30:02 +0100
Message-ID <qXYaS-63Z-5@gated-at.bofh.it> (permalink)
X-Original-To "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>, "arve@android.com" <arve@android.com>, "riandrews@android.com" <riandrews@android.com>, "robin.murphy@arm.com" <robin.murphy@arm.com>, "tixy@linaro.org" <tixy@linaro.org>, "sriram@marirs.net.in" <sriram@marirs.net.in>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=visteon.onmicrosoft.com; s=selector1-visteon-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=bWhbPKVTZjWjvj2QZodch/i1PL+A9V8J5gftdAsI/xY=; b=vAOSpZ/Slv3wDrVBCQNFPsneJIOnnZa956QPbZjj0adFg/T8COT8B7udSuWwF2Mf4SnlWjFpCCEj9YFzOn7iVVR9oZ/c/xPhZsZELdY257Tbn2RNf0s0ewQC9kKo89arwpM/pAl9/Du5sD5Sm61e1PrxheuDrb9yb6J9jLldau0=
Thread-Topic [PATCH] staging: android: ion: use the manged version of DMA memory allocation
Thread-Index AQHRXkMngvPaP4TMF0O1cE3BQz6vlQ==
Accept-Language en-US
Content-Language en-US
Authentication-Results linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=none action=none header.from=visteon.com;
X-Ms-Exchange-Messagesentrepresentingtype 1
X-Originating-IP [91.212.132.118]
X-Microsoft-Exchange-Diagnostics 1;DB5PR06MB1576;5:1W7rcVTuVSq+/qEJ5wEN6lh5wDoayQEVTRAqfCB+VgUBarIGeQxAVOZ8oi5AkSUJCjkednLudmxuwHgLgip9HekJsY/p2WGZk4DMGZcHobbnzopAp7qT0gUSf/DcCy1ufJjKFC3kcpo233dWapcaQw==;24:ca1jwyu8cGgctyxLnHFOoijs4X/DSfJo8TTgRzFgOry1Abxeijn+p3JsmqMswOQyQy1RSVuDHXIPo82C+CBmT5S+auYuXaF4G+eqaICDfgI=
X-Microsoft-Antispam UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB5PR06MB1576;
X-Ms-Office365-Filtering-Correlation-ID 7291ca09-f22a-4a0a-bcbb-08d32c5a4a70
X-Microsoft-Antispam-Prvs <DB5PR06MB15766F0E37F63B32635A76DACFD00@DB5PR06MB1576.eurprd06.prod.outlook.com>
X-Exchange-Antispam-Report-Test UriScan:(208512329853888);
X-Exchange-Antispam-Report-Cfa-Test BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046);SRVR:DB5PR06MB1576;BCL:0;PCL:0;RULEID:;SRVR:DB5PR06MB1576;
X-Forefront-Prvs 08417837C5
X-Forefront-Antispam-Report SFV:NSPM;SFS:(10019020)(6009001)(87936001)(189998001)(86362001)(5001960100002)(3280700002)(3660700001)(229853001)(33656002)(10400500002)(19580395003)(19580405001)(77096005)(5002640100001)(54356999)(2906002)(11100500001)(2201001)(4326007)(50986999)(2900100001)(92566002)(1076002)(1220700001)(1096002)(586003)(3846002)(106116001)(5001770100001)(6116002)(102836003)(40100003)(5008740100001)(2860100001)(122556002)(33716001)(66066001)(5004730100002)(2501003);DIR:OUT;SFP:1102;SCL:1;SRVR:DB5PR06MB1576;H:DB5PR06MB1573.eurprd06.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en;
Spamdiagnosticoutput 1:23
Spamdiagnosticmetadata NSPM
Content-Type text/plain; charset="us-ascii"
Content-ID <30A995EF106ED04BA7AF5F89C5C08916@eurprd06.prod.outlook.com>
Content-Transfer-Encoding 8BIT
MIME-Version 1.0
X-Originatororg visteon.com
X-Ms-Exchange-Crosstenant-Originalarrivaltime 03 Feb 2016 05:24:29.6171 (UTC)
X-Ms-Exchange-Crosstenant-Fromentityheader Hosted
X-Ms-Exchange-Crosstenant-ID 7a147aaf-01ec-498c-80a1-e34a8c63c548
X-Ms-Exchange-Transport-Crosstenantheadersstamped DB5PR06MB1576
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 54
Organization linux.* mail to news gateway
X-Original-Cc "devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
X-Original-Date Wed, 3 Feb 2016 05:24:29 +0000
X-Original-Message-ID <20160203052541.GA24772@IND12F0122>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1324919

Show key headers only | View raw


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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[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

csiph-web