Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4906982pxb; Tue, 28 Sep 2021 06:42:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZbgXTIU8KiZj1j2p0c+sV+a+6L1Kl71rRr7lKx9XNWLMNuZ+DX3M+EohAv1WR1lh8tIXI X-Received: by 2002:aa7:d897:: with SMTP id u23mr7773979edq.116.1632836560883; Tue, 28 Sep 2021 06:42:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632836560; cv=none; d=google.com; s=arc-20160816; b=UOCUEsZwEX+pm+DUFhVGU7lZL+t0/xpIFvAgSKDeyQ08A3PM5s4W0/9vqeQBCvCD73 7vaZQ7qM95d/40mtL8eYYJKCrVTrtGSEmDrqgWAiiZz1/e6a+jyc/mGf22McUFMZpt8s 2PIbyQevxqyL6Ivs0fyNR+qYUAPst3MkMf1cY22QwnoMOyg+gjtUjt53ltweCH3Hv7UT FLZ6zeWYZBQDebPrxgQfObC6l9afloaUFxW3ea9E3DwKLOjKmdaKyn+KrVT+0gYPuUb0 DbSQ9d1WE3kp3/9Psky7sqgVZW6IJjT+zYKBverHnq50Hxu/AWOBjPNglnayZL23B+aX xLrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=VikJjE3nMhi7jrdQTthl4IdR2YeNIyJhd0SszSpFlb4=; b=AK4LrUqn1LTzxDzG6hkF38GI28/jcTVfUuFgzuMcKItznT5zeXVzhG1oGB6+zyt/ze wE4erdnSf2mepdaoX3YnLBbdr3utsPAYyFDLhG9WjsWowpbUus+9qycbameILXkPGK3i K3tok/fxlfXiqJRWhCENjVvSPeCed0Wz4abl02qzYg+YFrhEsnm+fRuKeh4JnXOboHcD QHj0iu1iIQ98hn9onzAxe7mRvOs5TyJXgDujl8I8HloFmNA9nLh/wpioBdTjJEWq+bVZ oSxwUpgsHXGayq4OaG1KR8O7Qt0lHCTMB+sDi76Bh2rGXXQHXaJrquxIbYmUVMCXyoSg thbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gz23si21588271ejc.599.2021.09.28.06.42.15; Tue, 28 Sep 2021 06:42:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240848AbhI1NkM (ORCPT + 99 others); Tue, 28 Sep 2021 09:40:12 -0400 Received: from mx24.baidu.com ([111.206.215.185]:45838 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240882AbhI1NkL (ORCPT ); Tue, 28 Sep 2021 09:40:11 -0400 Received: from BC-Mail-Ex12.internal.baidu.com (unknown [172.31.51.52]) by Forcepoint Email with ESMTPS id 536C2E7DFD5F9B455AC8; Tue, 28 Sep 2021 21:22:05 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex12.internal.baidu.com (172.31.51.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Tue, 28 Sep 2021 21:22:05 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Tue, 28 Sep 2021 21:22:04 +0800 From: Cai Huoqing To: , , , , , CC: , , Cai Huoqing Subject: [PATCH] net: mdio-ipq4019: Fix the error for an optional regs resource Date: Tue, 28 Sep 2021 21:21:57 +0800 Message-ID: <20210928132157.2027-1-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex16.internal.baidu.com (172.31.51.56) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The second resource is optional which is only provided on the chipset IPQ5018. But the blamed commit ignores that and if the resource is not there it just fails. the resource is used like this, if (priv->eth_ldo_rdy) { val = readl(priv->eth_ldo_rdy); val |= BIT(0); writel(val, priv->eth_ldo_rdy); fsleep(IPQ_PHY_SET_DELAY_US); } This patch reverts that to still allow the second resource to be optional because other SoC have the some MDIO controller and doesn't need to second resource. Fix Commit fa14d03e014a ("net: mdio-ipq4019: Make use of devm_platform_ioremap_resource()") Signed-off-by: Cai Huoqing --- drivers/net/mdio/mdio-ipq4019.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/mdio/mdio-ipq4019.c b/drivers/net/mdio/mdio-ipq4019.c index 0d7d3e15d2f0..5f4cd24a0241 100644 --- a/drivers/net/mdio/mdio-ipq4019.c +++ b/drivers/net/mdio/mdio-ipq4019.c @@ -207,6 +207,7 @@ static int ipq4019_mdio_probe(struct platform_device *pdev) { struct ipq4019_mdio_data *priv; struct mii_bus *bus; + struct resource *res; int ret; bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*priv)); @@ -224,7 +225,10 @@ static int ipq4019_mdio_probe(struct platform_device *pdev) return PTR_ERR(priv->mdio_clk); /* The platform resource is provided on the chipset IPQ5018 */ - priv->eth_ldo_rdy = devm_platform_ioremap_resource(pdev, 1); + /* This resource is optional */ + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + if (res) + priv->eth_ldo_rdy = devm_ioremap_resource(&pdev->dev, res); bus->name = "ipq4019_mdio"; bus->read = ipq4019_mdio_read; -- 2.25.1