From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933111AbcBCFYd (ORCPT ); Wed, 3 Feb 2016 00:24:33 -0500 Received: from mail-db3on0141.outbound.protection.outlook.com ([157.55.234.141]:2551 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751214AbcBCFYb convert rfc822-to-8bit (ORCPT ); Wed, 3 Feb 2016 00:24:31 -0500 From: "Gujulan Elango, Hari Prasath (H.)" To: "gregkh@linuxfoundation.org" , "arve@android.com" , "riandrews@android.com" , "robin.murphy@arm.com" , "tixy@linaro.org" , "sriram@marirs.net.in" CC: "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH] staging: android: ion: use the manged version of DMA memory allocation Thread-Topic: [PATCH] staging: android: ion: use the manged version of DMA memory allocation Thread-Index: AQHRXkMngvPaP4TMF0O1cE3BQz6vlQ== Date: Wed, 3 Feb 2016 05:24:29 +0000 Message-ID: <20160203052541.GA24772@IND12F0122> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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: 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: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hari Prasath Gujulan Elango 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 --- 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