netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: of_mdio: fix behavior on missing phy device
@ 2013-05-07  9:49 Sebastian Hesselbarth
  2013-05-07 17:55 ` Sergei Shtylyov
  2013-05-08 20:14 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Sebastian Hesselbarth @ 2013-05-07  9:49 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Grant Likely,
	David Miller

of_mdiobus_register creates a phy_device even if get_phy_device failed
to create it previously. This causes indefinite polling on non-existent
PHYs. This fix makes of_mdio_register rely on get_phy_device to
properly create the device or fail otherwise.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
Cc: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
 drivers/of/of_mdio.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index 23049ae..d5a57a9 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -84,13 +84,10 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
 		phy = get_phy_device(mdio, addr, is_c45);
 
 		if (!phy || IS_ERR(phy)) {
-			phy = phy_device_create(mdio, addr, 0, false, NULL);
-			if (!phy || IS_ERR(phy)) {
-				dev_err(&mdio->dev,
-					"error creating PHY at address %i\n",
-					addr);
-				continue;
-			}
+			dev_err(&mdio->dev,
+				"cannot get PHY at address %i\n",
+				addr);
+			continue;
 		}
 
 		/* Associate the OF node with the device structure so it
-- 
1.7.10.4

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

* Re: [PATCH] net: of_mdio: fix behavior on missing phy device
  2013-05-07  9:49 [PATCH] net: of_mdio: fix behavior on missing phy device Sebastian Hesselbarth
@ 2013-05-07 17:55 ` Sergei Shtylyov
  2013-05-08 20:14 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2013-05-07 17:55 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Grant Likely, Rob Herring, David Miller, devicetree-discuss,
	linux-kernel, netdev

Hello.

On 07-05-2013 13:49, Sebastian Hesselbarth wrote:

> of_mdiobus_register creates a phy_device even if get_phy_device failed
> to create it previously. This causes indefinite polling on non-existent
> PHYs. This fix makes of_mdio_register rely on get_phy_device to
> properly create the device or fail otherwise.

> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> ---
> Cc: Grant Likely <grant.likely@linaro.org>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: David Miller <davem@davemloft.net>
> Cc: devicetree-discuss@lists.ozlabs.org
> Cc: linux-kernel@vger.kernel.org
> Cc: netdev@vger.kernel.org
> ---
>   drivers/of/of_mdio.c |   11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)

> diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
> index 23049ae..d5a57a9 100644
> --- a/drivers/of/of_mdio.c
> +++ b/drivers/of/of_mdio.c
> @@ -84,13 +84,10 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
>   		phy = get_phy_device(mdio, addr, is_c45);
>

    This empty line is not needed -- would be good to drop it, while at 
this.

>   		if (!phy || IS_ERR(phy)) {
> -			phy = phy_device_create(mdio, addr, 0, false, NULL);
> -			if (!phy || IS_ERR(phy)) {
> -				dev_err(&mdio->dev,
> -					"error creating PHY at address %i\n",
> -					addr);
> -				continue;
> -			}
> +			dev_err(&mdio->dev,
> +				"cannot get PHY at address %i\n",
> +				addr);
> +			continue;
>   		}
>
>   		/* Associate the OF node with the device structure so it
>

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

* Re: [PATCH] net: of_mdio: fix behavior on missing phy device
  2013-05-07  9:49 [PATCH] net: of_mdio: fix behavior on missing phy device Sebastian Hesselbarth
  2013-05-07 17:55 ` Sergei Shtylyov
@ 2013-05-08 20:14 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2013-05-08 20:14 UTC (permalink / raw)
  To: sebastian.hesselbarth
  Cc: grant.likely, rob.herring, devicetree-discuss, linux-kernel,
	netdev

From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Date: Tue,  7 May 2013 11:49:31 +0200

> of_mdiobus_register creates a phy_device even if get_phy_device failed
> to create it previously. This causes indefinite polling on non-existent
> PHYs. This fix makes of_mdio_register rely on get_phy_device to
> properly create the device or fail otherwise.
> 
> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>

Applied.

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

end of thread, other threads:[~2013-05-08 20:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-07  9:49 [PATCH] net: of_mdio: fix behavior on missing phy device Sebastian Hesselbarth
2013-05-07 17:55 ` Sergei Shtylyov
2013-05-08 20:14 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).