net: phy: use of_mdio_parse_addr
Subsystems (3)
PATCH 1/1 net: phy: use of_mdio_parse_addr
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)
--- drivers/net/phy/mdio_bus.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/net/phy/mdio_bus.c +2 -13
@@ -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;
Signature · 1 line
2.7.4
Quoted 5 lines · Jon Mason
use
of_mdio_parse_addr()in place of an OF read of reg and a bounds check (which is litterally the exact same thing thatof_mdio_parse_addr()does)Signed-off-by Jon Mason <[email protected]>
Andrew
Quoted 5 lines · Jon Mason
use
of_mdio_parse_addr()in place of an OF read of reg and a bounds check (which is litterally the exact same thing thatof_mdio_parse_addr()does)Signed-off-by Jon Mason <[email protected]>
Signature · 1 line
Florian
From: Jon Mason <[email protected]>
Date: Wed, 31 May 2017 15:43:30 -0400
Quoted 5 lines
use
of_mdio_parse_addr()in place of an OF read of reg and a bounds check (which is litterally the exact same thing thatof_mdio_parse_addr()does)Signed-off-by Jon Mason <[email protected]>
Applied, thanks Jon.
Quoted 10 lines · David Miller
From: Jon Mason <[email protected]>
Date: Wed, 31 May 2017 15:43:30 -0400Quoted 5 lines
use
of_mdio_parse_addr()in place of an OF read of reg and a bounds check (which is litterally the exact same thing thatof_mdio_parse_addr()does)Signed-off-by Jon Mason <[email protected]>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
Quoted 12 lines · Liviu Dudau
Quoted 10 lines · David Miller
From: Jon Mason <[email protected]>
Date: Wed, 31 May 2017 15:43:30 -0400Quoted 5 lines
use
of_mdio_parse_addr()in place of an OF read of reg and a bounds check (which is litterally the exact same thing thatof_mdio_parse_addr()does)Signed-off-by Jon Mason <[email protected]>Applied, thanks Jon.
Quoted 7 lines
This makes linux-next fail the
modules_installtarget 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
I did not test this as modules. Sorry.
It would be ugly to duplicate the code in both place, and the code in question does not seem to really need to be in a C file. Perhaps it can be moved to a header file as an inline function, which would solve this dependency. Would this be acceptable?
Thanks,
Jon
Quoted 7 lines
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
Quoted 21 lines · Jon Mason
Quoted 12 lines · Liviu Dudau
Quoted 10 lines · David Miller
From: Jon Mason <[email protected]>
Date: Wed, 31 May 2017 15:43:30 -0400Quoted 5 lines
use
of_mdio_parse_addr()in place of an OF read of reg and a bounds check (which is litterally the exact same thing thatof_mdio_parse_addr()does)Signed-off-by Jon Mason <[email protected]>Applied, thanks Jon.
Quoted 7 lines
This makes linux-next fail the
modules_installtarget 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
Quoted 6 lines
I did not test this as modules. Sorry.
It would be ugly to duplicate the code in both place, and the code in question does not seem to really need to be in a C file. Perhaps it can be moved to a header file as an inline function, which would solve this dependency. Would this be acceptable?
You read my mind, was just going to suggest doing that.
Signature · 1 line
Florian
Quoted 15 lines · Liviu Dudau
Quoted 10 lines · David Miller
From: Jon Mason <[email protected]>
Date: Wed, 31 May 2017 15:43:30 -0400Quoted 5 lines
use
of_mdio_parse_addr()in place of an OF read of reg and a bounds check (which is litterally the exact same thing thatof_mdio_parse_addr()does)Signed-off-by Jon Mason <[email protected]>Applied, thanks Jon.
This makes linux-next fail the
modules_installtarget as depmod detects 2 circular dependencies. Reverting this patch fixes the issue.
Quoted 7 lines
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 1This 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.
Same happens on 32-bit powerpc.
cheers