mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cai Huoqing <caihuoqing@baidu.com>
To: Horatiu Vultur <horatiu.vultur@microchip.com>
Cc: <andrew@lunn.ch>, <hkallweit1@gmail.com>, <linux@armlinux.org.uk>,
	<davem@davemloft.net>, <kuba@kernel.org>, <caihuoqing@baidu.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Horatiu Vultur <horatiu.vultur@microchip.com>
Subject: Re: [PATCH net] net: mdio: mscc-miim: Fix the mdio controller
Date: Tue, 28 Sep 2021 16:54:14 +0800	[thread overview]
Message-ID: <20210928085414.GA1723@LAPTOP-UKSR4ENP.internal.baidu.com> (raw)
In-Reply-To: <20210928071720.2084666-1-horatiu.vultur@microchip.com>

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 <horatiu.vultur@microchip.com>
> ---
>  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
> 

  reply	other threads:[~2021-09-28  8:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28  7:17 Horatiu Vultur
2021-09-28  8:54 ` Cai Huoqing [this message]
2021-09-28 12:00   ` Andrew Lunn
2021-09-28 12:19 ` Cai Huoqing
2021-09-28 12:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210928085414.GA1723@LAPTOP-UKSR4ENP.internal.baidu.com \
    --to=caihuoqing@baidu.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®