Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp518041yba; Sun, 31 Mar 2019 05:42:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBCj33f1E1GJGzYklA3nEom72dQzyIXPhcac32NAkf9jfyVZTRL8nZtv+71LkX/T2ciHWp X-Received: by 2002:a63:5947:: with SMTP id j7mr6199938pgm.62.1554036156213; Sun, 31 Mar 2019 05:42:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554036156; cv=none; d=google.com; s=arc-20160816; b=Yg6c5k+Vp6qGU0ol/sea9UuuazHJzZFDqewSnpQZUbzliVS7FPNpZUWB056lMV9w0l e8DhmBkmY/h2VBXQqrJSBgEJYW/TtymuGJiJK1uCZanlIv7rSDob5hrMZxNbKsY87//L DiHxZ6CbRiFo0b642ELK8bTYWsR7sn/RP0+oBvJ9SdAccxoQoQA/ODU8L2CUxD8Gei3+ G4yyAOszar3JA1ylJZRHshCsUONjp+Os89t/BbAfHC1htlF0pO/0XG8VQPBDAI/wcq6z B5vPl72NkqLm7HgKO5fiC3kBfn7P2ENe9rJP/AzCtWPZfxkt+Arj6xVUfTw6zK0LBezN zZgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=isl0rVJ+lvnuZCss7whzv5D/07SZm8kGMMyQFL9/lp0=; b=TWdzqmahVYAzTiaem66DJ/cSRaU2eJIsUMIbTlMW6apP5nk6rvLFwfr+byqAWLGEeM 6li+1PyPqJ7Dr7/dHhKozEgiVqrlB0eNaHjDdulFtgrqugBNeuNw38AZXKx0PlD1bVbW aMWr/cdijhNaGRAkfdNW50JavEvA+PEHCRPANLB8Up50QvgZKnqKhEpJ9pzOhI8cje3p 3RxCvFwy7AVUAf4/QIcHPhphUrflrZN9O4YGTCbuB3ZNNJrBW4bdNa1pCLm2NM7WoeLO 4zFE6C4ngOFnd9WV3iN+5+6usXkOggJjpEKsBqRngJJMoFc1ezNxp3S670eSiGHTd0SI TBUQ== 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 136si6558778pfc.170.2019.03.31.05.42.20; Sun, 31 Mar 2019 05:42:36 -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 S1731192AbfCaMlj (ORCPT + 99 others); Sun, 31 Mar 2019 08:41:39 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:3439 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726807AbfCaMli (ORCPT ); Sun, 31 Mar 2019 08:41:38 -0400 X-UUID: 8568858f9d414c019ba805168e463cfb-20190331 X-UUID: 8568858f9d414c019ba805168e463cfb-20190331 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 629506759; Sun, 31 Mar 2019 20:41:34 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sun, 31 Mar 2019 20:41:26 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Sun, 31 Mar 2019 20:41:26 +0800 From: Chunfeng Yun To: Ryder Lee , Honghui Zhang , Lorenzo Pieralisi CC: Bjorn Helgaas , Matthias Brugger , , , , , Chunfeng Yun Subject: [v2 PATCH] PCI: mediatek: get optional clock by devm_clk_get_optional() Date: Sun, 31 Mar 2019 20:41:03 +0800 Message-ID: <1554036063-1381-1-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use devm_clk_get_optional() to get optional clock Cc: Ryder Lee Cc: Honghui Zhang Signed-off-by: Chunfeng Yun --- v2: 1. cc Ryder and Honghui 2. fix up omitted 'if (IS_ERR())' --- drivers/pci/controller/pcie-mediatek.c | 50 ++++++++------------------ 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c index 0b6c72804e03..adb6cb15daa2 100644 --- a/drivers/pci/controller/pcie-mediatek.c +++ b/drivers/pci/controller/pcie-mediatek.c @@ -915,49 +915,29 @@ 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); + if (IS_ERR(port->axi_ck)) + 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); + if (IS_ERR(port->aux_ck)) + 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); + if (IS_ERR(port->obff_ck)) + 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); + if (IS_ERR(port->pipe_ck)) + return PTR_ERR(port->pipe_ck); snprintf(name, sizeof(name), "pcie-rst%d", slot); port->reset = devm_reset_control_get_optional_exclusive(dev, name); -- 2.20.1