Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp152515yba; Sat, 30 Mar 2019 17:48:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqyChg4T8nVro2AutuF1mg/f5xU+ALq3DGIukmfpKHOdGbJ5Hwj8b4LFFIHHv08nRbOejm2X X-Received: by 2002:a65:51c8:: with SMTP id i8mr3497510pgq.175.1553993310764; Sat, 30 Mar 2019 17:48:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553993310; cv=none; d=google.com; s=arc-20160816; b=Jy3VkfAyM9noY18K1jeLmDOI5vYA4762pzz38CnbjtzizjIdsvgpa2f22l4BSTYxcS 43gGAshztlyG4iEk7PQL4SGZj3Q5zzLBRbhPD6MhNO+euGmanALuRBKmja46KeiH8x/C eWEYf1xfMRitLKQsrLR7sTpw6tUjGbqocodHvDpZkgnYpsxzhBInOcaQcv0v2cEQm9BV /4uEBPPIU/5y8v/aMTXzWJWpEbCY/6t+VH2NKPnVFGerbM1zQnD4ibhtFo0rfO0SM1wz sAFmkm5uOVnZspD/+NI+6sYJE/z+g7jBUukJt9qqj30g1KidQI+gCMxESRTJssNoBnxX XLrA== 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=HL4A1LJwnZ8cfHVSrV+wJ+J+dwpvxI7pTtWGU1Kj2WY=; b=EJS/U+rTLFSqA6pp3sqExRG5lN9MX3VU4j3yejTjCb/4Dijxsst/GuCrQQTG+gsNXu oIf2YT6zZ+Hork/7w1jVsf4le/0GjuqrFDeAesrZ5m8EaB+qzaxIhL+ynmgYovE79s8K 3t3shcxzHqgf96+OeHRbld7bHvm/1ZiJcDreHScM3BvouL9R2mAFyaDm3htRs05sQsRJ PWTHYpYO6b4cg9D/+rEDoIiZLQLcw9i3jKyGVlV28iFO6dQ6WRAA/sMso3nH0DKi4sqN imkW3FVWOOvWWtJEKDq2nNccpKDqgEKW6shTQuw+WDiF/o/e6Yd9KtGZhF30+dLMhi83 9Blg== 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 s5si5492607plr.307.2019.03.30.17.47.44; Sat, 30 Mar 2019 17:48:30 -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 S1731068AbfCaAqG (ORCPT + 99 others); Sat, 30 Mar 2019 20:46:06 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:27871 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730998AbfCaAqG (ORCPT ); Sat, 30 Mar 2019 20:46:06 -0400 X-UUID: f17aa5f617074c0da9cb38324430d645-20190331 X-UUID: f17aa5f617074c0da9cb38324430d645-20190331 Received: from mtkcas34.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 2115593357; Sun, 31 Mar 2019 08:45:57 +0800 Received: from MTKCAS32.mediatek.inc (172.27.4.184) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sun, 31 Mar 2019 08:45:56 +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 08:45:55 +0800 Message-ID: <1553993155.7748.2.camel@mhfsdcap03> Subject: Re: [PATCH] PCI: mediatek: get optional clock by devm_clk_get_optional() From: Honghui Zhang To: Chunfeng Yun CC: Ryder Lee , Lorenzo Pieralisi , Bjorn Helgaas , "Matthias Brugger" , , , , Date: Sun, 31 Mar 2019 08:45:55 +0800 In-Reply-To: <1553940051-10367-1-git-send-email-chunfeng.yun@mediatek.com> References: <1553940051-10367-1-git-send-email-chunfeng.yun@mediatek.com> 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 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); > Hi, Chunfeng, Thanks for this patch, I had not noticed that the devm_clk_get_optional have been applied, I like this change. Acked-by: Honghui Zhang > snprintf(name, sizeof(name), "pcie-rst%d", slot); > port->reset = devm_reset_control_get_optional_exclusive(dev, name);