Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp2354174ybb; Sat, 30 Mar 2019 03:02:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/OuXYQ4fn/29Jks7WB3Jksq38Ek7LY2pQCuZi4ctXkiKiF2Efh4ld3yjXQT3knU/6HooO X-Received: by 2002:a17:902:728e:: with SMTP id d14mr51587739pll.327.1553940124174; Sat, 30 Mar 2019 03:02:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553940124; cv=none; d=google.com; s=arc-20160816; b=AS/x1d2ZVT5VmRBVHdQiaqzWrb3J5RWQDp4BxVh4OTTOhx3UaE9NPUUr4lSJKcH05a lm9WFe0uyYCEmRMGBjbkMs1EzQM5v9QSVhfqgZTb39B9P3OrBqar+xidvLm4PwHsX1Y1 gNLJ97HQhUN1eSt3H69M+6rU21vQ0kS613blohrRj2syFHHdACIdNS6Rob747+cwDmGr ugERWMB+0NlvUv2qYFAdYFDUeQhHB/LxXgNBZ1mLkGuCZV49S9rz/fQLqq90psAnRdxP 76m8jRewAoSKZ39OtEArkURc7kK7Gw3soVuVU0rUUFrequZXWjHQ+0wfuha6bKMhaz5u f+6w== 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=MwcPDJclRmKxroBQ0XgXcafteZgdXesWeFc+T5ZtrgE=; b=g68F8arc+/YmXddSJN8DZMDng/8yryP6DgcfoPhnq3jXuth7V1h99W+MlvDPtCrC4L R9mhDutStZTToK3G4s5fS95L4dxRwhSL8nQdMZs9qrTLbP9EUPdwZEPr6hDIOQ6rHxWS j10lz7GLljmetLyvzNdXXGX/bD1IRAO0RQuyqBkT2LAY618evZcXmhYrVVdAyEi4v6oa EOqDBNK3i4DI7CS3hshQMyuWBWXWqV2/IYn8IIcpnPBjYqg30ApctzeXhAdxUdK4WngC 4JD6/5LNPrBt0OnhZZ42sw/BaliKTO3ixqfQDrsrr19yc2SxlliMQM/5H8ZiKhOeLchb 1t0A== 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 z70si4134815pgd.86.2019.03.30.03.01.44; Sat, 30 Mar 2019 03:02:04 -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 S1730631AbfC3KBE (ORCPT + 99 others); Sat, 30 Mar 2019 06:01:04 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:14883 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730474AbfC3KBD (ORCPT ); Sat, 30 Mar 2019 06:01:03 -0400 X-UUID: d6dadaeebc8f40e68a8e73bd5111d592-20190330 X-UUID: d6dadaeebc8f40e68a8e73bd5111d592-20190330 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 277456615; Sat, 30 Mar 2019 18:00:55 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sat, 30 Mar 2019 18:00:53 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Sat, 30 Mar 2019 18:00:53 +0800 From: Chunfeng Yun To: Ryder Lee , Honghui Zhang , Lorenzo Pieralisi CC: Bjorn Helgaas , Matthias Brugger , , , , , Chunfeng Yun Subject: [PATCH] PCI: mediatek: get optional clock by devm_clk_get_optional() Date: Sat, 30 Mar 2019 18:00:51 +0800 Message-ID: <1553940051-10367-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 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); -- 2.20.1