Skip to contentSkip to conversation

net: phy: Allow splitting MDIO bus/device support from PHYs

RFC In review Florian Fainelli 3 participants 4 messages Jan 31, 2017 – Feb 7, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 net: phy: Allow splitting MDIO bus/device support from PHYs

Introduce a new configuration symbol: MDIO_DEVICE which allows building the MDIO devices and bus code, without pulling in the entire Ethernet PHY library and devices code.

PHYLIB nows select MDIO_DEVICE and the relevant Makefile files are updated to reflect that.

---
 drivers/net/Makefile       |  2 +-
 drivers/net/phy/Kconfig    | 59 ++++++++++++++++++++++++++--------------------
 drivers/net/phy/Makefile   |  3 ++-
 drivers/net/phy/mdio_bus.c |  2 ++
 4 files changed, 39 insertions(+), 27 deletions(-)
drivers/net/Makefile +1 -1
index 7336cbd3ef5d..a701e390d48f 100644
@@ -17,7 +17,7 @@ obj-$(CONFIG_MII) += mii.o
 obj-$(CONFIG_MDIO) += mdio.o
 obj-$(CONFIG_NET) += Space.o loopback.o
 obj-$(CONFIG_NETCONSOLE) += netconsole.o
-obj-$(CONFIG_PHYLIB) += phy/
+obj-$(CONFIG_MDIO_DEVICE) += phy/
 obj-$(CONFIG_RIONET) += rionet.o
 obj-$(CONFIG_NET_TEAM) += team/
 obj-$(CONFIG_TUN) += tun.o
drivers/net/phy/Kconfig +34 -25

73 lines not on this page · raw message

drivers/net/phy/Makefile +2 -1
index 356859ac7c18..441d228f53ed 100644
@@ -1,6 +1,7 @@
 # Makefile for Linux PHY drivers and MDIO bus drivers
 
-libphy-y			:= phy.o phy_device.o mdio_bus.o mdio_device.o
+libphy-y			:= phy.o phy_device.o
+obj-$(CONFIG_MDIO_DEVICE)	+= mdio_device.o mdio_bus.o
 libphy-$(CONFIG_SWPHY)		+= swphy.o
 libphy-$(CONFIG_LED_TRIGGER_PHY)	+= phy_led_triggers.o
 
drivers/net/phy/mdio_bus.c +2 -0
index 653d076eafe5..fa6bd2a2ce3e 100644
@@ -644,9 +644,11 @@ int __init mdio_bus_init(void)
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(mdio_bus_init);
 
 void mdio_bus_exit(void)
 {
 	class_unregister(&mdio_bus_class);
 	bus_unregister(&mdio_bus_type);
 }
+EXPORT_SYMBOL_GPL(mdio_bus_exit);
Signature · 1 line
2.9.3
#1 lore raw
Quoted 8 lines · Florian Fainelli

Introduce a new configuration symbol: MDIO_DEVICE which allows building the MDIO devices and bus code, without pulling in the entire Ethernet PHY library and devices code.

PHYLIB nows select MDIO_DEVICE and the relevant Makefile files are updated to reflect that.

Andrew, Russell, does that seem sensible to you, shall I re-submit this as a proper patch?

Signature · 1 line
Florian
maintainer
#2 lore raw
Quoted 11 lines
Quoted 8 lines

Introduce a new configuration symbol: MDIO_DEVICE which allows building the MDIO devices and bus code, without pulling in the entire Ethernet PHY library and devices code.

PHYLIB nows select MDIO_DEVICE and the relevant Makefile files are updated to reflect that.

Andrew, Russell, does that seem sensible to you, shall I re-submit this as a proper patch?

Hi Florian

It does make sense, given that we have some MDIO busses not used for networking.

Andrew

#3 lore raw
In reply to Florian Fainelli
Quoted 5 lines · Florian Fainelli
Quoted 4 lines · Florian Fainelli

Introduce a new configuration symbol: MDIO_DEVICE which allows building the MDIO devices and bus code, without pulling in the entire Ethernet PHY library and devices code.

Quoted 7 lines
Quoted 4 lines

PHYLIB nows select MDIO_DEVICE and the relevant Makefile files are updated to reflect that.

Andrew, Russell, does that seem sensible to you, shall I re-submit this as a proper patch?

I think the only comment I have is that I'd recommend that mdio_bus and mdio_device end up as one module rather than two for these reasons:

1. they're each relatively small on their own
2. their functionality is tightly related
3. I wonder about the safety of having mdio_device_release() in a separate module from the bus_type stuff.

as far as (3) goes, there isn't a good way to ensure that the last device has been released, and bus_type's (even though they normally end up as static data) are refcounted objects just like devices, so I wonder whether allowing driver model bus stuff to be removable is a good idea.

To that end, I'd add a module_init() for mdio_bus_init() but remove mdio_bus_exit() entirely, which should mean that the module loader considers the module non-removable.

Lastly, as this is becoming (a) separate module(s), MODULE_LICENSE() as an absolute minimum will be required.

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.