From patchwork Mon Jun 19 10:00:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryder Lee X-Patchwork-Id: 9795645 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CF7CB60381 for ; Mon, 19 Jun 2017 10:00:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE7D31FF73 for ; Mon, 19 Jun 2017 10:00:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D152527FA5; Mon, 19 Jun 2017 10:00:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 620FC1FF73 for ; Mon, 19 Jun 2017 10:00:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754000AbdFSKAP (ORCPT ); Mon, 19 Jun 2017 06:00:15 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:61567 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754001AbdFSKAO (ORCPT ); Mon, 19 Jun 2017 06:00:14 -0400 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 73508393; Mon, 19 Jun 2017 18:00:04 +0800 Received: from mtkexhb02.mediatek.inc (172.21.101.103) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Mon, 19 Jun 2017 18:00:03 +0800 Received: from mtkslt306.mediatek.inc (10.21.14.136) by mtkexhb02.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Mon, 19 Jun 2017 18:00:03 +0800 From: Ryder Lee To: Bjorn Helgaas CC: , , , , Ryder Lee Subject: [PATCH 3/3] PCI: mediatek: make some properties optioanl Date: Mon, 19 Jun 2017 18:00:00 +0800 Message-ID: <1497866400-41844-4-git-send-email-ryder.lee@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1497866400-41844-1-git-send-email-ryder.lee@mediatek.com> References: <1497866400-41844-1-git-send-email-ryder.lee@mediatek.com> MIME-Version: 1.0 X-MTK: N Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some properties for PCIe controller are optional and therefore change to use *optional* function. Signed-off-by: Ryder Lee --- drivers/pci/host/pcie-mediatek.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/pci/host/pcie-mediatek.c b/drivers/pci/host/pcie-mediatek.c index d256263..91a6328 100644 --- a/drivers/pci/host/pcie-mediatek.c +++ b/drivers/pci/host/pcie-mediatek.c @@ -306,18 +306,15 @@ static int mtk_pcie_parse_ports(struct mtk_pcie *pcie, } snprintf(name, sizeof(name), "pcie-rst%d", index); - port->reset = devm_reset_control_get(dev, name); - if (IS_ERR(port->reset)) { - dev_err(dev, "failed to get port%d reset\n", index); + port->reset = devm_reset_control_get_optional(dev, name); + if (PTR_ERR(port->reset) == -EPROBE_DEFER) return PTR_ERR(port->reset); - } + /* some platforms may use default PHY setting */ snprintf(name, sizeof(name), "pcie-phy%d", index); - port->phy = devm_phy_get(dev, name); - if (IS_ERR(port->phy)) { - dev_err(dev, "failed to get port%d phy\n", index); + port->phy = devm_phy_optional_get(dev, name); + if (IS_ERR(port->phy)) return PTR_ERR(port->phy); - } port->index = index; port->pcie = pcie; @@ -345,8 +342,10 @@ static int mtk_pcie_subsys_powerup(struct mtk_pcie *pcie) pcie->free_ck = devm_clk_get(dev, "free_ck"); if (IS_ERR(pcie->free_ck)) { - dev_err(dev, "failed to get free_ck\n"); - return PTR_ERR(pcie->free_ck); + if (PTR_ERR(pcie->free_ck) == -EPROBE_DEFER) + return -EPROBE_DEFER; + + pcie->free_ck = NULL; } if (dev->pm_domain) {