Skip to contentSkip to conversation

net: phy: rework Kconfig settings for MDIO_BUS

RFC In review Arnd Bergmann 2 participants 4 messages Jun 21, 2017 – Jun 28, 2017

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

RFC 1/2 net: phy: rework Kconfig settings for MDIO_BUS

I still see build errors in randconfig builds and have had this patch for a while to locally work around it:

drivers/built-in.o: In function `xgene_mdio_probe':
mux-core.c:(.text+0x352154): undefined reference to of_mdiobus_register' mux-core.c:(.text+0x352168): undefined reference to mdiobus_free' mux-core.c:(.text+0x3521c0): undefined reference to `mdiobus_alloc_size'

The idea is that CONFIG_MDIO_BUS now reflects whether the mdio_bus code is built-in or a module, and other drivers that use the core code can simply depend on that, instead of having a complex dependency line.

Fixes 90eff9096c01 ("net: phy: Allow splitting MDIO bus/device support from PHYs")
---
 drivers/net/phy/Kconfig | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/net/phy/Kconfig +10 -3
index 2dda72004a7d..928fd892f167 100644
@@ -7,7 +7,16 @@ menuconfig MDIO_DEVICE
 	help
 	   MDIO devices and driver infrastructure code.
 
-if MDIO_DEVICE
+config MDIO_BUS
+	tristate
+	default m if PHYLIB=m
+	default MDIO_DEVICE
+	help
+	  This internal symbol is used for link time dependencies and it
+	  reflects whether the mdio_bus/mdio_device code is built as a
+	  loadable module or built-in.
+
+if MDIO_BUS
 
 config MDIO_BCM_IPROC
 	tristate "Broadcom iProc MDIO bus controller"
@@ -28,7 +37,6 @@ config MDIO_BCM_UNIMAC
 
 config MDIO_BITBANG
 	tristate "Bitbanged MDIO buses"
-	depends on !(MDIO_DEVICE=y && PHYLIB=m)
 	help
 	  This module implements the MDIO bus protocol in software,
 	  for use by low level drivers that export the ability to
@@ -127,7 +135,6 @@ config MDIO_THUNDER
 	tristate "ThunderX SOCs MDIO buses"
 	depends on 64BIT
 	depends on PCI
-	depends on !(MDIO_DEVICE=y && PHYLIB=m)
 	select MDIO_CAVIUM
 	help
 	  This driver supports the MDIO interfaces found on Cavium
Signature · 1 line
2.9.0
#1 lore raw

RFC 2/2 phy: bcm-ns-usb3: fix MDIO_BUS dependency

The driver attempts to 'select MDIO_DEVICE', but the code is actually a loadable module when PHYLIB=m:

drivers/phy/broadcom/phy-bcm-ns-usb3.o: In function `bcm_ns_usb3_mdiodev_phy_write':
phy-bcm-ns-usb3.c:(.text.bcm_ns_usb3_mdiodev_phy_write+0x28): undefined reference to mdiobus_write' drivers/phy/broadcom/phy-bcm-ns-usb3.o: In function bcm_ns_usb3_module_exit':
phy-bcm-ns-usb3.c:(.exit.text+0x18): undefined reference to mdio_driver_unregister' drivers/phy/broadcom/phy-bcm-ns-usb3.o: In function bcm_ns_usb3_module_init':
phy-bcm-ns-usb3.c:(.init.text+0x18): undefined reference to mdio_driver_register' phy-bcm-ns-usb3.c:(.init.text+0x38): undefined reference to mdio_driver_unregister'

Using 'depends on MDIO_BUS' instead will avoid the link error.

Fixes af850e14a7ae ("phy: bcm-ns-usb3: add MDIO driver using proper bus layer")
---
 drivers/phy/broadcom/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/broadcom/Kconfig +1 -1
index 37371b89b14f..64fc59c3ae6d 100644
@@ -30,8 +30,8 @@ config PHY_BCM_NS_USB3
 	tristate "Broadcom Northstar USB 3.0 PHY Driver"
 	depends on ARCH_BCM_IPROC || COMPILE_TEST
 	depends on HAS_IOMEM && OF
+	depends on MDIO_BUS
 	select GENERIC_PHY
-	select MDIO_DEVICE
 	help
 	  Enable this to support Broadcom USB 3.0 PHY connected to the USB
 	  controller on Northstar family.
Signature · 1 line
2.9.0
Reviewed-by on v1 2/2
#2 lore raw

Re: [RFC 2/2] phy: bcm-ns-usb3: fix MDIO_BUS dependency

Quoted 11 lines · Arnd Bergmann

The driver attempts to 'select MDIO_DEVICE', but the code is actually a loadable module when PHYLIB=m:

drivers/phy/broadcom/phy-bcm-ns-usb3.o: In function `bcm_ns_usb3_mdiodev_phy_write':
phy-bcm-ns-usb3.c:(.text.bcm_ns_usb3_mdiodev_phy_write+0x28): undefined reference to mdiobus_write' drivers/phy/broadcom/phy-bcm-ns-usb3.o: In function bcm_ns_usb3_module_exit':
phy-bcm-ns-usb3.c:(.exit.text+0x18): undefined reference to mdio_driver_unregister' drivers/phy/broadcom/phy-bcm-ns-usb3.o: In function bcm_ns_usb3_module_init':
phy-bcm-ns-usb3.c:(.init.text+0x18): undefined reference to mdio_driver_register' phy-bcm-ns-usb3.c:(.init.text+0x38): undefined reference to mdio_driver_unregister'

Quoted 4 lines

Using 'depends on MDIO_BUS' instead will avoid the link error.

Fixes af850e14a7ae ("phy: bcm-ns-usb3: add MDIO driver using proper bus layer")
Signature · 1 line
Florian
Reviewed-by on v1 1/2
#3 lore raw
In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann

I still see build errors in randconfig builds and have had this patch for a while to locally work around it:

drivers/built-in.o: In function `xgene_mdio_probe':
mux-core.c:(.text+0x352154): undefined reference to of_mdiobus_register' mux-core.c:(.text+0x352168): undefined reference to mdiobus_free' mux-core.c:(.text+0x3521c0): undefined reference to `mdiobus_alloc_size'

Quoted 7 lines

The idea is that CONFIG_MDIO_BUS now reflects whether the mdio_bus code is built-in or a module, and other drivers that use the core code can simply depend on that, instead of having a complex dependency line.

Fixes 90eff9096c01 ("net: phy: Allow splitting MDIO bus/device support from PHYs")

This looks a lot better indeed, thanks!

Signature · 1 line
Florian