Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1654588 > unrolled thread

[PATCH net-next] net: phy: use of_mdio_parse_addr

Started byJon Mason <jon.mason@broadcom.com>
First post2017-05-31 21:50 +0200
Last post2017-06-07 18:30 +0200
Articles 5 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH net-next] net: phy: use of_mdio_parse_addr Jon Mason <jon.mason@broadcom.com> - 2017-05-31 21:50 +0200
    Re: [PATCH net-next] net: phy: use of_mdio_parse_addr Andrew Lunn <andrew@lunn.ch> - 2017-05-31 22:10 +0200
    Re: [PATCH net-next] net: phy: use of_mdio_parse_addr Florian Fainelli <florian.fainelli@broadcom.com> - 2017-05-31 22:10 +0200
    Re: [PATCH net-next] net: phy: use of_mdio_parse_addr David Miller <davem@davemloft.net> - 2017-06-02 20:30 +0200
      Re: [PATCH net-next] net: phy: use of_mdio_parse_addr Liviu Dudau <liviu@dudau.co.uk> - 2017-06-07 18:30 +0200

#1654588 — [PATCH net-next] net: phy: use of_mdio_parse_addr

FromJon Mason <jon.mason@broadcom.com>
Date2017-05-31 21:50 +0200
Subject[PATCH net-next] net: phy: use of_mdio_parse_addr
Message-ID<tNhN1-CQ-39@gated-at.bofh.it>
use of_mdio_parse_addr() in place of an OF read of reg and a bounds
check (which is litterally the exact same thing that
of_mdio_parse_addr() does)

Signed-off-by: Jon Mason <jon.mason@broadcom.com>
---
 drivers/net/phy/mdio_bus.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 8e73f5f36e71..d4782e902e2e 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -263,21 +263,10 @@ static void of_mdiobus_link_mdiodev(struct mii_bus *bus,
 
 	for_each_available_child_of_node(bus->dev.of_node, child) {
 		int addr;
-		int ret;
 
-		ret = of_property_read_u32(child, "reg", &addr);
-		if (ret < 0) {
-			dev_err(dev, "%s has invalid MDIO address\n",
-				child->full_name);
+		addr = of_mdio_parse_addr(dev, child);
+		if (addr < 0)
 			continue;
-		}
-
-		/* A MDIO device must have a reg property in the range [0-31] */
-		if (addr >= PHY_MAX_ADDR) {
-			dev_err(dev, "%s MDIO address %i is too large\n",
-				child->full_name, addr);
-			continue;
-		}
 
 		if (addr == mdiodev->addr) {
 			dev->of_node = child;
-- 
2.7.4

[toc] | [next] | [standalone]


#1654599

FromAndrew Lunn <andrew@lunn.ch>
Date2017-05-31 22:10 +0200
Message-ID<tNi6m-YB-9@gated-at.bofh.it>
In reply to#1654588
On Wed, May 31, 2017 at 03:43:30PM -0400, Jon Mason wrote:
> use of_mdio_parse_addr() in place of an OF read of reg and a bounds
> check (which is litterally the exact same thing that
> of_mdio_parse_addr() does)
> 
> Signed-off-by: Jon Mason <jon.mason@broadcom.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

[toc] | [prev] | [next] | [standalone]


#1654600

FromFlorian Fainelli <florian.fainelli@broadcom.com>
Date2017-05-31 22:10 +0200
Message-ID<tNi6m-YB-11@gated-at.bofh.it>
In reply to#1654588
On 05/31/2017 12:43 PM, Jon Mason wrote:
> use of_mdio_parse_addr() in place of an OF read of reg and a bounds
> check (which is litterally the exact same thing that
> of_mdio_parse_addr() does)
> 
> Signed-off-by: Jon Mason <jon.mason@broadcom.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

[toc] | [prev] | [next] | [standalone]


#1656456

FromDavid Miller <davem@davemloft.net>
Date2017-06-02 20:30 +0200
Message-ID<tNZuG-4Jd-25@gated-at.bofh.it>
In reply to#1654588
From: Jon Mason <jon.mason@broadcom.com>
Date: Wed, 31 May 2017 15:43:30 -0400

> use of_mdio_parse_addr() in place of an OF read of reg and a bounds
> check (which is litterally the exact same thing that
> of_mdio_parse_addr() does)
> 
> Signed-off-by: Jon Mason <jon.mason@broadcom.com>

Applied, thanks Jon.

[toc] | [prev] | [next] | [standalone]


#1659999

FromLiviu Dudau <liviu@dudau.co.uk>
Date2017-06-07 18:30 +0200
Message-ID<tPM0i-zo-29@gated-at.bofh.it>
In reply to#1656456
On Fri, Jun 02, 2017 at 02:22:51PM -0400, David Miller wrote:
> From: Jon Mason <jon.mason@broadcom.com>
> Date: Wed, 31 May 2017 15:43:30 -0400
> 
> > use of_mdio_parse_addr() in place of an OF read of reg and a bounds
> > check (which is litterally the exact same thing that
> > of_mdio_parse_addr() does)
> > 
> > Signed-off-by: Jon Mason <jon.mason@broadcom.com>
> 
> Applied, thanks Jon.

This makes linux-next fail the modules_install target as depmod detects 2 circular
dependencies. Reverting this patch fixes the issue.

depmod: ERROR: Cycle detected: libphy -> of_mdio -> fixed_phy -> libphy
depmod: ERROR: Cycle detected: libphy -> of_mdio -> libphy
depmod: ERROR: Found 3 modules in dependency cycles!
make[1]: *** [/home/dliviu/devel/kernel/Makefile:1245: _modinst_post] Error 1

This is on an ARCH=arm build, build I doubt it makes a difference. Let me know if
you need some .config values in order to reproduce.

Best regards,
Liviu

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web