All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: mdio: mscc-miim: Fix the mdio controller
@ 2021-09-28  7:17 Horatiu Vultur
  2021-09-28  8:54 ` Cai Huoqing
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Horatiu Vultur @ 2021-09-28  7:17 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, kuba, caihuoqing, netdev, linux-kernel
  Cc: Horatiu Vultur

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: mdio: mscc-miim: Fix the mdio controller
  2021-09-28  7:17 [PATCH net] net: mdio: mscc-miim: Fix the mdio controller Horatiu Vultur
@ 2021-09-28  8:54 ` Cai Huoqing
  2021-09-28 12:00   ` Andrew Lunn
  2021-09-28 12:19 ` Cai Huoqing
  2021-09-28 12:30 ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 5+ messages in thread
From: Cai Huoqing @ 2021-09-28  8:54 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: andrew, hkallweit1, linux, davem, kuba, caihuoqing, netdev,
	linux-kernel, Horatiu Vultur

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
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: mdio: mscc-miim: Fix the mdio controller
  2021-09-28  8:54 ` Cai Huoqing
@ 2021-09-28 12:00   ` Andrew Lunn
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2021-09-28 12:00 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: Horatiu Vultur, hkallweit1, linux, davem, kuba, netdev, linux-kernel

On Tue, Sep 28, 2021 at 04:54:14PM +0800, Cai Huoqing wrote:
> 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:)

Hi

Since it was a separate patch which broken it, it should be a separate
patch which fixes it.  Please send a fix.

You can also give a Reviewed-by: to Horatiu patch, if you think it is
correct.

Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: mdio: mscc-miim: Fix the mdio controller
  2021-09-28  7:17 [PATCH net] net: mdio: mscc-miim: Fix the mdio controller Horatiu Vultur
  2021-09-28  8:54 ` Cai Huoqing
@ 2021-09-28 12:19 ` Cai Huoqing
  2021-09-28 12:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: Cai Huoqing @ 2021-09-28 12:19 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: andrew, hkallweit1, linux, davem, kuba, netdev, linux-kernel

On 28 9月 21 09:17:20, Horatiu Vultur wrote:
> 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>

Reviewed-by: Cai Huoqing <caihuoqing@baidu.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 */
Looks good to me,

Thanks,
Cai
> +	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
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: mdio: mscc-miim: Fix the mdio controller
  2021-09-28  7:17 [PATCH net] net: mdio: mscc-miim: Fix the mdio controller Horatiu Vultur
  2021-09-28  8:54 ` Cai Huoqing
  2021-09-28 12:19 ` Cai Huoqing
@ 2021-09-28 12:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-09-28 12:30 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: andrew, hkallweit1, linux, davem, kuba, caihuoqing, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Tue, 28 Sep 2021 09:17:20 +0200 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net] net: mdio: mscc-miim: Fix the mdio controller
    https://git.kernel.org/netdev/net/c/c6995117b60e

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-28 12:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28  7:17 [PATCH net] net: mdio: mscc-miim: Fix the mdio controller Horatiu Vultur
2021-09-28  8:54 ` Cai Huoqing
2021-09-28 12:00   ` Andrew Lunn
2021-09-28 12:19 ` Cai Huoqing
2021-09-28 12:30 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.