Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp517367yba; Sun, 31 Mar 2019 05:41:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJLMjePxpwD+1qSmCnp8GMMTOwLPe1EXtg9uokAoVzGYpEuDTmwEU5WyZ8uYb/A+oTcSYu X-Received: by 2002:aa7:864a:: with SMTP id a10mr59273162pfo.181.1554036081540; Sun, 31 Mar 2019 05:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554036081; cv=none; d=google.com; s=arc-20160816; b=JnnwY9DujzU9QG+rnKCUQCQfZlAfeivKgFtiLKa86pHjWlOjiTnwPuVZQlXQqhVBZZ zsKJul+OvP+I2myQaO63bUKEF4DSNGsHUTUfYG917u5vvCfhfWZT8akmO57g/xoLTw/J LpcI877r8GmuGMo2lLbM5p5jB4Kt3k2aq/QrpjaUyo1t1nBOf0Ns5MfFbhG2lJ3ZXK+1 zTLjLT8jz0AHa84vGrJIniOXHMcvhUxJWYkxwHyyEOib8iaRHjYC+pYsade98/K57UAV hHyCKV9zhqzAXlyiLbvEMO7o/XI33Bs91aB5+i8EWaVxplSosyR0M0REnijPS4l7ywyE 9rjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id; bh=8X81Nmi+2fPXxxLNg7j/mMCfbWxGh/kfzIumBajGUCY=; b=Sr7bEzxWUuoECrUTOQZ1DcZABFJsdOVZJMQ6g9YL3VvteowSvFCrNsYokmvh7Lnwe/ SuB+irGlLgkUm0DHwahKxGMdER5Jwr3h3p60htHQJ51nM0QBBNYRiQT1g8VIM9b1dTqA qOH9US0oKd8zl3dxOY9CpHZDl4JFsLf9ngvEgPjnh+dISR6c1Mo8EexX41r8JiPsAeQc zzvTZ9riSuUMarcN/79b6x7mcXWgtAvsnSnkiggffP1kN3rK4bj0d0CYGe8iw2qPiIJI PwkT5KlDTy9adZVCSHY5ncodPrpz3A4BD0GLOu0Exx2+pxgM/MdBCSCJBVAXQ/EdLpvv YtZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s17si2302175plq.135.2019.03.31.05.41.04; Sun, 31 Mar 2019 05:41:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731158AbfCaMk3 (ORCPT + 99 others); Sun, 31 Mar 2019 08:40:29 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:36968 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726807AbfCaMk3 (ORCPT ); Sun, 31 Mar 2019 08:40:29 -0400 X-UUID: 0783840e59b04b2d9ca14dc223875ca3-20190331 X-UUID: 0783840e59b04b2d9ca14dc223875ca3-20190331 Received: from mtkcas35.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 96863905; Sun, 31 Mar 2019 20:40:10 +0800 Received: from MTKCAS32.mediatek.inc (172.27.4.184) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sun, 31 Mar 2019 20:40:08 +0800 Received: from [10.17.3.153] (172.27.4.253) by MTKCAS32.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Sun, 31 Mar 2019 20:40:08 +0800 Message-ID: <1554036008.10179.174.camel@mhfsdcap03> Subject: Re: [PATCH] PCI: mediatek: get optional clock by devm_clk_get_optional() From: Chunfeng Yun To: Ryder Lee CC: Honghui Zhang , Lorenzo Pieralisi , Bjorn Helgaas , "Matthias Brugger" , , , , Date: Sun, 31 Mar 2019 20:40:08 +0800 In-Reply-To: <1554027049.21644.0.camel@mtkswgap22> References: <1553940051-10367-1-git-send-email-chunfeng.yun@mediatek.com> <1554027049.21644.0.camel@mtkswgap22> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ryder, On Sun, 2019-03-31 at 18:10 +0800, Ryder Lee wrote: > On Sat, 2019-03-30 at 18:00 +0800, Chunfeng Yun wrote: > > Use devm_clk_get_optional() to get optional clock > > > > Signed-off-by: Chunfeng Yun > > --- > > drivers/pci/controller/pcie-mediatek.c | 46 ++++++-------------------- > > 1 file changed, 11 insertions(+), 35 deletions(-) > > > > diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c > > index 0b6c72804e03..9a66a018489b 100644 > > --- a/drivers/pci/controller/pcie-mediatek.c > > +++ b/drivers/pci/controller/pcie-mediatek.c > > @@ -915,49 +915,25 @@ static int mtk_pcie_parse_port(struct mtk_pcie *pcie, > > > > /* sys_ck might be divided into the following parts in some chips */ > > snprintf(name, sizeof(name), "ahb_ck%d", slot); > > - port->ahb_ck = devm_clk_get(dev, name); > > - if (IS_ERR(port->ahb_ck)) { > > - if (PTR_ERR(port->ahb_ck) == -EPROBE_DEFER) > > - return -EPROBE_DEFER; > > - > > - port->ahb_ck = NULL; > > - } > > + port->ahb_ck = devm_clk_get_optional(dev, name); > > + if (IS_ERR(port->ahb_ck)) > > + return PTR_ERR(port->ahb_ck); > > > > snprintf(name, sizeof(name), "axi_ck%d", slot); > > - port->axi_ck = devm_clk_get(dev, name); > > - if (IS_ERR(port->axi_ck)) { > > - if (PTR_ERR(port->axi_ck) == -EPROBE_DEFER) > > - return -EPROBE_DEFER; > > - > > - port->axi_ck = NULL; > > - } > > + port->axi_ck = devm_clk_get_optional(dev, name); > > + return PTR_ERR(port->axi_ck); > > > > snprintf(name, sizeof(name), "aux_ck%d", slot); > > - port->aux_ck = devm_clk_get(dev, name); > > - if (IS_ERR(port->aux_ck)) { > > - if (PTR_ERR(port->aux_ck) == -EPROBE_DEFER) > > - return -EPROBE_DEFER; > > - > > - port->aux_ck = NULL; > > - } > > + port->aux_ck = devm_clk_get_optional(dev, name); > > + return PTR_ERR(port->aux_ck); > > > > snprintf(name, sizeof(name), "obff_ck%d", slot); > > - port->obff_ck = devm_clk_get(dev, name); > > - if (IS_ERR(port->obff_ck)) { > > - if (PTR_ERR(port->obff_ck) == -EPROBE_DEFER) > > - return -EPROBE_DEFER; > > - > > - port->obff_ck = NULL; > > - } > > + port->obff_ck = devm_clk_get_optional(dev, name); > > + return PTR_ERR(port->obff_ck); > > > > snprintf(name, sizeof(name), "pipe_ck%d", slot); > > - port->pipe_ck = devm_clk_get(dev, name); > > - if (IS_ERR(port->pipe_ck)) { > > - if (PTR_ERR(port->pipe_ck) == -EPROBE_DEFER) > > - return -EPROBE_DEFER; > > - > > - port->pipe_ck = NULL; > > - } > > + port->pipe_ck = devm_clk_get_optional(dev, name); > > + return PTR_ERR(port->pipe_ck); > > > > snprintf(name, sizeof(name), "pcie-rst%d", slot); > > port->reset = devm_reset_control_get_optional_exclusive(dev, name); > > if (IS_ERR(...)) ? Very sorry for my stupid mistake:( will send new version >