Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4699246pxb; Tue, 28 Sep 2021 01:55:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTYUQVxyLW8rqNAHWnypqhJMWJG6KlUfX5IvcOXa0D8fUBndVVlO+bxLT480iT854Il5e5 X-Received: by 2002:aa7:9499:0:b0:445:1c9c:3c1b with SMTP id z25-20020aa79499000000b004451c9c3c1bmr4275758pfk.8.1632819348131; Tue, 28 Sep 2021 01:55:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632819348; cv=none; d=google.com; s=arc-20160816; b=kfvhQcLV5J9Vp7fPtf1KdKhtaOC5Bnb0W9XHttv+z6sZ+nMs7V6FVmWw27M8EFLzha oCOVt+Eb0xxfVqlHbvHfz1QWnKf81b2pi7OQvtIGD2/QlxxGWl/Rs5Rl2t+m7bU4+xJ1 UenX0AO9K8H6Jhx0DSqo4uH5vR/XeJDose5jMec/zzlv77QDIKepVSG9mBRiwQufZbjY fRdIlLFc27pC4qP0O1sV+szBxsUdssQISkEtlzIwouR29j0z+/HVsCpKw1SL5f7NyaKw od9YQbarrALScbm947lUB3d9l8HNF2yFhqn2S0USML4KVeD7BnIayP5c/XWylbtY0o3I 4eQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=0IbJdZdzxp/e1havWAXLSOWflW2CZwZZm42jrti2xrI=; b=bcS8G9clJIiwHJO+weXmra81SB7cO9bj0qm4PVs90qdDNSC5Jw1lzoJEcqZUHrNxhw 3zwoa0swFBGEd8/OCgbGQfugwclh/a75+30N6/dRs/lL4Fri/9TsohRiNgLmSZeedylY +J8uKCj8YC+3gykKfajFPJqV60zyHqgFEuySG6o2u7ZmIMDZIXITXtA4crnOkDvlk5Am kQdEW62NbGHF6+6QMtW44/rvzI1/YiUkqVpAL2YqE+jKmbVKSLuRnDL5v8t3qNow/EWs kC9qUFgoZnDj6eEfRyJDFytCSqJn4k+8RUDtOJwpknm9VIPqJ4cTjItykV1V6NT57XE7 A60A== 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 75si21411785pga.225.2021.09.28.01.55.34; Tue, 28 Sep 2021 01:55:48 -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 S239683AbhI1I4B (ORCPT + 99 others); Tue, 28 Sep 2021 04:56:01 -0400 Received: from mx22.baidu.com ([220.181.50.185]:34848 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235918AbhI1I4A (ORCPT ); Tue, 28 Sep 2021 04:56:00 -0400 Received: from BC-Mail-Ex15.internal.baidu.com (unknown [172.31.51.55]) by Forcepoint Email with ESMTPS id E802520A90A62FF4BC50; Tue, 28 Sep 2021 16:54:16 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex15.internal.baidu.com (172.31.51.55) 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 16:54:16 +0800 Received: from localhost (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 16:54:16 +0800 Date: Tue, 28 Sep 2021 16:54:14 +0800 From: Cai Huoqing To: Horatiu Vultur CC: , , , , , , , , Horatiu Vultur Subject: Re: [PATCH net] net: mdio: mscc-miim: Fix the mdio controller Message-ID: <20210928085414.GA1723@LAPTOP-UKSR4ENP.internal.baidu.com> References: <20210928071720.2084666-1-horatiu.vultur@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210928071720.2084666-1-horatiu.vultur@microchip.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex24.internal.baidu.com (172.31.51.18) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28 9月 21 09:17:20, Horatiu Vultur wrote: Hi Horatiu, Thank for your feedback. I'm sorry for this commit, my mistake. After I have checked my recent submission history the commit- commit fa14d03e014a130839f9dc1b97ea61fe598d873d drivers/net/mdio/mdio-ipq4019.c 225 line has the same issue, an optional phy-regs Are you willing to fix it at the same time:) Many thanks. > According to the documentation the second resource is optional. But the > blamed commit ignores that and if the resource is not there it just > fails. > > 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. > > Fixes: 672a1c394950 ("net: mdio: mscc-miim: Make use of the helper function devm_platform_ioremap_resource()") > Signed-off-by: Horatiu Vultur > --- > drivers/net/mdio/mdio-mscc-miim.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c > index 1ee592d3eae4..17f98f609ec8 100644 > --- a/drivers/net/mdio/mdio-mscc-miim.c > +++ b/drivers/net/mdio/mdio-mscc-miim.c > @@ -134,8 +134,9 @@ static int mscc_miim_reset(struct mii_bus *bus) > > static int mscc_miim_probe(struct platform_device *pdev) > { > - struct mii_bus *bus; > struct mscc_miim_dev *dev; > + struct resource *res; > + struct mii_bus *bus; > int ret; > > bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*dev)); > @@ -156,10 +157,14 @@ static int mscc_miim_probe(struct platform_device *pdev) > return PTR_ERR(dev->regs); > } > > - dev->phy_regs = devm_platform_ioremap_resource(pdev, 1); > - if (IS_ERR(dev->phy_regs)) { > - dev_err(&pdev->dev, "Unable to map internal phy registers\n"); > - return PTR_ERR(dev->phy_regs); > + /* This resource is optional */ > + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); > + if (res) { > + dev->phy_regs = devm_ioremap_resource(&pdev->dev, res); > + if (IS_ERR(dev->phy_regs)) { > + dev_err(&pdev->dev, "Unable to map internal phy registers\n"); > + return PTR_ERR(dev->phy_regs); > + } > } > > ret = of_mdiobus_register(bus, pdev->dev.of_node); > -- > 2.33.0 >