Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752281AbcDUREa (ORCPT ); Thu, 21 Apr 2016 13:04:30 -0400 Received: from mail-cys01nam02on0066.outbound.protection.outlook.com ([104.47.37.66]:55001 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751340AbcDURE1 (ORCPT ); Thu, 21 Apr 2016 13:04:27 -0400 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Date: Thu, 21 Apr 2016 10:02:15 -0700 From: =?utf-8?B?U8O2cmVu?= Brinkmann To: Appana Durga Kedareswara Rao CC: Soren Brinkmann , "robh+dt@kernel.org" , "pawel.moll@arm.com" , "mark.rutland@arm.com" , "ijc+devicetree@hellion.org.uk" , "galak@codeaurora.org" , Michal Simek , "vinod.koul@intel.com" , "dan.j.williams@intel.com" , "moritz.fischer@ettus.com" , "laurent.pinchart@ideasonboard.com" , "luis@debethencourt.com" , Anirudha Sarangi , Punnaiah Choudary Kalluri , Shubhrajyoti Datta , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "dmaengine@vger.kernel.org" Subject: Re: [PATCH v3 3/3] dmaengine: vdma: Add clock support Message-ID: <20160421170215.GB7128@xsjsorenbubuntu> References: <1461235118-800-1-git-send-email-appanad@xilinx.com> <1461235118-800-4-git-send-email-appanad@xilinx.com> <20160421162153.GZ7128@xsjsorenbubuntu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-22274.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(377454003)(199003)(377424004)(13464003)(24454002)(189002)(6806005)(81166005)(87936001)(1076002)(1220700001)(50466002)(189998001)(54356999)(36386004)(1096002)(85182001)(106466001)(77096005)(586003)(4001350100001)(57986006)(11100500001)(92566002)(47776003)(9686002)(50986999)(4001450100002)(86362001)(76176999)(9786002)(33656002)(23676002)(76506005)(4326007)(2950100001)(63266004)(33716001)(83506001)(93886004)(2906002)(85202003)(19580395003)(2870700001)(5008740100001)(19580405001)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:BL2NAM02HT018;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;MLV:sfv;A:1;MX:1;LANG:en; X-MS-Office365-Filtering-Correlation-Id: 2f5ac95a-7a8f-47bb-e317-08d36a06fe06 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(8251501002);SRVR:BL2NAM02HT018; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(9101521026)(601004)(2401047)(8121501046)(13017025)(13015025)(13018025)(5005006)(13024025)(13023025)(3002001)(10201501046);SRVR:BL2NAM02HT018;BCL:0;PCL:0;RULEID:;SRVR:BL2NAM02HT018; X-Forefront-PRVS: 091949432C X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2016 17:04:25.0927 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2NAM02HT018 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2671 Lines: 66 On Thu, 2016-04-21 at 09:32:44 -0700, Appana Durga Kedareswara Rao wrote: > Hi Soren, > > > -----Original Message----- > > From: Sören Brinkmann [mailto:soren.brinkmann@xilinx.com] > > Sent: Thursday, April 21, 2016 9:52 PM > > To: Appana Durga Kedareswara Rao > > Cc: robh+dt@kernel.org; pawel.moll@arm.com; mark.rutland@arm.com; > > ijc+devicetree@hellion.org.uk; galak@codeaurora.org; Michal Simek > > ; vinod.koul@intel.com; dan.j.williams@intel.com; > > Appana Durga Kedareswara Rao ; > > moritz.fischer@ettus.com; laurent.pinchart@ideasonboard.com; > > luis@debethencourt.com; Anirudha Sarangi ; Punnaiah > > Choudary Kalluri ; Shubhrajyoti Datta > > ; devicetree@vger.kernel.org; linux-arm- > > kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > > dmaengine@vger.kernel.org > > Subject: Re: [PATCH v3 3/3] dmaengine: vdma: Add clock support > > > > On Thu, 2016-04-21 at 16:08:38 +0530, Kedareswara rao Appana wrote: [...] > > > @@ -1757,6 +1767,200 @@ static void xilinx_dma_chan_remove(struct > > xilinx_dma_chan *chan) > > > list_del(&chan->common.device_node); > > > } > > > > > > +static int axidma_clk_init(struct platform_device *pdev, struct clk **axi_clk, > > > + struct clk **tx_clk, struct clk **rx_clk, > > > + struct clk **sg_clk, struct clk **tmp_clk) { > > > + int err; > > > + > > > + *tmp_clk = NULL; > > > + > > > + *axi_clk = devm_clk_get(&pdev->dev, "s_axi_lite_aclk"); > > > + if (IS_ERR(*axi_clk)) { > > > + err = PTR_ERR(*axi_clk); > > > + dev_err(&pdev->dev, "failed to get axi_aclk (%u)\n", err); > > > + return err; > > > + } > > > + > > > + *tx_clk = devm_clk_get(&pdev->dev, "m_axi_mm2s_aclk"); > > > + if (IS_ERR(*tx_clk)) > > > + *tx_clk = NULL; > > > + > > > + *rx_clk = devm_clk_get(&pdev->dev, "m_axi_s2mm_aclk"); > > > + if (IS_ERR(*rx_clk)) > > > + *rx_clk = NULL; > > > + > > > + *sg_clk = devm_clk_get(&pdev->dev, "m_axi_sg_aclk"); > > > + if (IS_ERR(*sg_clk)) > > > + *sg_clk = NULL; > > > + > > > + > > > + err = clk_prepare_enable(*axi_clk); > > > > Should this be called if you know that the pointer might be NULL? > > It is a mandatory clock and if this clk is not there in DT I am already returning error... > I didn't get your question could you please elaborate??? But for all the optional clocks. They could all be NULL and you're calling clk_prepare_enable with a NULL pointer. That function is nice enough to do a NULL check for you, but I wonder whether these calls should happen at all when you already know that the pointer is not a valid clock. Sören