From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752103AbcBLKRr (ORCPT ); Fri, 12 Feb 2016 05:17:47 -0500 Received: from smtprelay0079.hostedemail.com ([216.40.44.79]:44725 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751102AbcBLKRo (ORCPT ); Fri, 12 Feb 2016 05:17:44 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1381:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:1981:2194:2199:2393:2559:2562:2828:2899:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:3872:3874:4250:4321:5007:6261:10004:10400:10848:11026:11232:11658:11783:11914:12043:12048:12296:12438:12517:12519:12740:13069:13095:13138:13161:13229:13231:13255:13311:13357:13894:14659:21080:30003:30054:30064:30083:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: rub61_26266301ee441 X-Filterd-Recvd-Size: 2190 Message-ID: <1455272260.13149.11.camel@perches.com> Subject: Re: [PATCH] Platform: goldfish: goldfish_pipe.c: Add DMA support using managed version From: Joe Perches To: Shraddha Barke , Greg Kroah-Hartman , Peter Senna Tschudin , Dan Carpenter , linux-kernel@vger.kernel.org Date: Fri, 12 Feb 2016 02:17:40 -0800 In-Reply-To: <20160212072337.GA21805@shraddha-370R4E-370R4V-370R5E-3570RE-370R5V> References: <20160212072337.GA21805@shraddha-370R4E-370R4V-370R5E-3570RE-370R5V> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.3-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2016-02-12 at 12:53 +0530, Shraddha Barke wrote: > setup_access_params_addr has 2 goals- > > -Initialize the access_params field so that it can be used to send and read > commands from the device in access_with_param > -Get a bus address for the allocated memory to transfer to the device. > > Replace the combination of devm_kzalloc and _pa() with dmam_alloc_coherent. trivia: > diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c [] > @@ -217,17 +218,18 @@ static int valid_batchbuffer_addr(struct goldfish_pipe_dev *dev, >  static int setup_access_params_addr(struct platform_device *pdev, >   struct goldfish_pipe_dev *dev) >  { > - u64 paddr; > + dma_addr_t dma_handle; >   struct access_params *aps; >   > - aps = devm_kzalloc(&pdev->dev, sizeof(struct access_params), GFP_KERNEL); > - if (!aps) > - return -1; > + aps = dmam_alloc_coherent(&pdev->dev, sizeof(struct access_params), > +     &dma_handle, GFP_KERNEL); > + if (!aps) { > + dev_err(&pdev->dev, "allocate buffer failed\n"); This is still an unnecessary allocation failure message. There's already a generic OOM message and stack dump emitted.