Skip to contentSkip to conversation

net: ethernet: Add missing depends on MDIO_DEVRES

PATCH Applied Andrew Lunn 4 participants 7 messages Apr 9, 2023 – Apr 13, 2023

Subsystems (4)
lore
Share & tools
lore

Andrew Lunn

author maintainer
#0 lore raw

PATCH 1/1 net: ethernet: Add missing depends on MDIO_DEVRES

A number of MDIO drivers make use of devm_mdiobus_alloc_size(). This is only available when CONFIG_MDIO_DEVRES is enabled. Add missing depends or selects, depending on if there are circular dependencies or not. This avoids linker errors, especially for randconfig builds.

---
 drivers/net/ethernet/freescale/Kconfig       | 1 +
 drivers/net/ethernet/freescale/enetc/Kconfig | 1 +
 drivers/net/ethernet/marvell/Kconfig         | 1 +
 drivers/net/ethernet/qualcomm/Kconfig        | 1 +
 drivers/net/mdio/Kconfig                     | 3 +++
 5 files changed, 7 insertions(+)
drivers/net/ethernet/freescale/Kconfig +1 -0
index f1e80d6996ef..1c78f66a89da 100644
@@ -71,6 +71,7 @@ config FSL_XGMAC_MDIO
 	tristate "Freescale XGMAC MDIO"
 	select PHYLIB
 	depends on OF
+	select MDIO_DEVRES
 	select OF_MDIO
 	help
 	  This driver supports the MDIO bus on the Fman 10G Ethernet MACs, and
drivers/net/ethernet/freescale/enetc/Kconfig +1 -0
index 9bc099cf3cb1..4d75e6807e92 100644
@@ -10,6 +10,7 @@ config FSL_ENETC_CORE
 config FSL_ENETC
 	tristate "ENETC PF driver"
 	depends on PCI_MSI
+	select MDIO_DEVRES
 	select FSL_ENETC_CORE
 	select FSL_ENETC_IERB
 	select FSL_ENETC_MDIO
drivers/net/ethernet/marvell/Kconfig +1 -0
index f58a1c0144ba..884d64114bff 100644
@@ -34,6 +34,7 @@ config MV643XX_ETH
 config MVMDIO
 	tristate "Marvell MDIO interface support"
 	depends on HAS_IOMEM
+	select MDIO_DEVRES
 	select PHYLIB
 	help
 	  This driver supports the MDIO interface found in the network
drivers/net/ethernet/qualcomm/Kconfig +1 -0
index a4434eb38950..9210ff360fdc 100644
@@ -52,6 +52,7 @@ config QCOM_EMAC
 	depends on HAS_DMA && HAS_IOMEM
 	select CRC32
 	select PHYLIB
+	select MDIO_DEVRES
 	help
 	  This driver supports the Qualcomm Technologies, Inc. Gigabit
 	  Ethernet Media Access Controller (EMAC). The controller
drivers/net/mdio/Kconfig +3 -0
index 90309980686e..9ff2e6f22f3f 100644
@@ -65,6 +65,7 @@ config MDIO_ASPEED
 	tristate "ASPEED MDIO bus controller"
 	depends on ARCH_ASPEED || COMPILE_TEST
 	depends on OF_MDIO && HAS_IOMEM
+	depends on MDIO_DEVRES
 	help
 	  This module provides a driver for the independent MDIO bus
 	  controllers found in the ASPEED AST2600 SoC. This is a driver for the
@@ -170,6 +171,7 @@ config MDIO_IPQ4019
 	tristate "Qualcomm IPQ4019 MDIO interface support"
 	depends on HAS_IOMEM && OF_MDIO
 	depends on COMMON_CLK
+	depends on MDIO_DEVRES
 	help
 	  This driver supports the MDIO interface found in Qualcomm
 	  IPQ40xx, IPQ60xx, IPQ807x and IPQ50xx series Soc-s.
@@ -178,6 +180,7 @@ config MDIO_IPQ8064
 	tristate "Qualcomm IPQ8064 MDIO interface support"
 	depends on HAS_IOMEM && OF_MDIO
 	depends on MFD_SYSCON
+	depends on MDIO_DEVRES
 	help
 	  This driver supports the MDIO interface found in the network
 	  interface units of the IPQ8064 SoC
Signature · 1 line
2.40.0
#1 lore raw
Quoted 19 lines · Andrew Lunn

A number of MDIO drivers make use of devm_mdiobus_alloc_size(). This is only available when CONFIG_MDIO_DEVRES is enabled. Add missing depends or selects, depending on if there are circular dependencies or not. This avoids linker errors, especially for randconfig builds.

---
 drivers/net/ethernet/freescale/Kconfig       | 1 +
 drivers/net/ethernet/freescale/enetc/Kconfig | 1 +
 drivers/net/ethernet/marvell/Kconfig         | 1 +
 drivers/net/ethernet/qualcomm/Kconfig        | 1 +
 drivers/net/mdio/Kconfig                     | 3 +++
 5 files changed, 7 insertions(+)
drivers/net/ethernet/freescale/Kconfig +0 -0
index f1e80d6996ef..1c78f66a89da 100644

drivers/net/ethernet/freescale/Kconfig config FSL_XGMAC_MDIO · line 77

Quoted 7 lines
drivers/net/ethernet/freescale/Kconfig +1 -0
@@ -71,6 +71,7 @@ config FSL_XGMAC_MDIO
 	tristate "Freescale XGMAC MDIO"
 	select PHYLIB
 	depends on OF
+	select MDIO_DEVRES
 	select OF_MDIO
 	help
 	  This driver supports the MDIO bus on the Fman 10G Ethernet MACs, and

Perhaps this is a good idea, but I'd like to mention that I don't think it is strictly necessary as:

1. FSL_XGMAC_MDIO selects PHYLIB.
2. And PHYLIB selects MDIO_DEVRES.

Likewise for FSL_ENETC, MV643XX_ETH, QCOM_EMAC.

Is there some combination of N/y/m that defeats my logic here? I feel like I am missing something obvious.

Quoted 41 lines
drivers/net/ethernet/freescale/enetc/Kconfig +1 -0
index 9bc099cf3cb1..4d75e6807e92 100644
@@ -10,6 +10,7 @@ config FSL_ENETC_CORE
 config FSL_ENETC
 	tristate "ENETC PF driver"
 	depends on PCI_MSI
+	select MDIO_DEVRES
 	select FSL_ENETC_CORE
 	select FSL_ENETC_IERB
 	select FSL_ENETC_MDIO
drivers/net/ethernet/marvell/Kconfig +1 -0
index f58a1c0144ba..884d64114bff 100644
@@ -34,6 +34,7 @@ config MV643XX_ETH
 config MVMDIO
 	tristate "Marvell MDIO interface support"
 	depends on HAS_IOMEM
+	select MDIO_DEVRES
 	select PHYLIB
 	help
 	  This driver supports the MDIO interface found in the network
drivers/net/ethernet/qualcomm/Kconfig +1 -0
index a4434eb38950..9210ff360fdc 100644
@@ -52,6 +52,7 @@ config QCOM_EMAC
 	depends on HAS_DMA && HAS_IOMEM
 	select CRC32
 	select PHYLIB
+	select MDIO_DEVRES
 	help
 	  This driver supports the Qualcomm Technologies, Inc. Gigabit
 	  Ethernet Media Access Controller (EMAC). The controller
drivers/net/mdio/Kconfig +0 -0
index 90309980686e..9ff2e6f22f3f 100644

drivers/net/mdio/Kconfig config MDIO_ASPEED · line 71

Quoted 7 lines
drivers/net/mdio/Kconfig +1 -0
@@ -65,6 +65,7 @@ config MDIO_ASPEED
 	tristate "ASPEED MDIO bus controller"
 	depends on ARCH_ASPEED || COMPILE_TEST
 	depends on OF_MDIO && HAS_IOMEM
+	depends on MDIO_DEVRES
 	help
 	  This module provides a driver for the independent MDIO bus
 	  controllers found in the ASPEED AST2600 SoC. This is a driver for the

Again, I'm not sure if this is necessary:

1. MDIO_ASPEED depends on OF_MDIO
2. OF_MDIO depends on PHYLIB
3. PHYLIB selects MDIO_DEVRES

Likewise for MDIO_IPQ4019 and MDIO_IPQ8064.

Quoted 19 lines
drivers/net/mdio/Kconfig +2 -0
@@ -170,6 +171,7 @@ config MDIO_IPQ4019
 	tristate "Qualcomm IPQ4019 MDIO interface support"
 	depends on HAS_IOMEM && OF_MDIO
 	depends on COMMON_CLK
+	depends on MDIO_DEVRES
 	help
 	  This driver supports the MDIO interface found in Qualcomm
 	  IPQ40xx, IPQ60xx, IPQ807x and IPQ50xx series Soc-s.
@@ -178,6 +180,7 @@ config MDIO_IPQ8064
 	tristate "Qualcomm IPQ8064 MDIO interface support"
 	depends on HAS_IOMEM && OF_MDIO
 	depends on MFD_SYSCON
+	depends on MDIO_DEVRES
 	help
 	  This driver supports the MDIO interface found in the network
 	  interface units of the IPQ8064 SoC
Signature · 1 line
2.40.0
author maintainer
#2 lore raw
Quoted 31 lines · Simon Horman
Quoted 19 lines · Andrew Lunn

A number of MDIO drivers make use of devm_mdiobus_alloc_size(). This is only available when CONFIG_MDIO_DEVRES is enabled. Add missing depends or selects, depending on if there are circular dependencies or not. This avoids linker errors, especially for randconfig builds.

---
 drivers/net/ethernet/freescale/Kconfig       | 1 +
 drivers/net/ethernet/freescale/enetc/Kconfig | 1 +
 drivers/net/ethernet/marvell/Kconfig         | 1 +
 drivers/net/ethernet/qualcomm/Kconfig        | 1 +
 drivers/net/mdio/Kconfig                     | 3 +++
 5 files changed, 7 insertions(+)
drivers/net/ethernet/freescale/Kconfig +0 -0
index f1e80d6996ef..1c78f66a89da 100644

drivers/net/ethernet/freescale/Kconfig config FSL_XGMAC_MDIO · line 77

Quoted 7 lines
drivers/net/ethernet/freescale/Kconfig +1 -0
@@ -71,6 +71,7 @@ config FSL_XGMAC_MDIO
 	tristate "Freescale XGMAC MDIO"
 	select PHYLIB
 	depends on OF
+	select MDIO_DEVRES
 	select OF_MDIO
 	help
 	  This driver supports the MDIO bus on the Fman 10G Ethernet MACs, and

Perhaps this is a good idea, but I'd like to mention that I don't think it is strictly necessary as:

Quoted 7 lines

1. FSL_XGMAC_MDIO selects PHYLIB.
2. And PHYLIB selects MDIO_DEVRES.

Likewise for FSL_ENETC, MV643XX_ETH, QCOM_EMAC.

Is there some combination of N/y/m that defeats my logic here? I feel like I am missing something obvious.

I keep getting 0-day randconfig build warning about kernel configuration which don't link. It seems to get worse when we add in support of MAC and PHY LEDs. My guess is, the additional dependencies for LEDs upsets the conflict resolution engine, and it comes out with a different solution. select is a soft dependency. It is more a hint, and can be ignored. And when a randconfig kernel fails to build, MDIO_DEVRES is disabled.

Where possible, i've added a depends on, which is a much stronger dependency. But that can lead to circular dependencies, which kconfig cannot handle. In such cases, i've added selects. Maybe having more selects for a config option will influence it to find a solution which has MDIO_DEVRES enabled?

I've had this patch in a github tree for a week or more, and 0-day has not yet returned any randconfig build errors. But i've not combined it with the LED code.

Andrew

#3 lore raw
Quoted 54 lines · Andrew Lunn
Quoted 31 lines · Simon Horman
Quoted 19 lines · Andrew Lunn

A number of MDIO drivers make use of devm_mdiobus_alloc_size(). This is only available when CONFIG_MDIO_DEVRES is enabled. Add missing depends or selects, depending on if there are circular dependencies or not. This avoids linker errors, especially for randconfig builds.

---
 drivers/net/ethernet/freescale/Kconfig       | 1 +
 drivers/net/ethernet/freescale/enetc/Kconfig | 1 +
 drivers/net/ethernet/marvell/Kconfig         | 1 +
 drivers/net/ethernet/qualcomm/Kconfig        | 1 +
 drivers/net/mdio/Kconfig                     | 3 +++
 5 files changed, 7 insertions(+)
drivers/net/ethernet/freescale/Kconfig +0 -0
index f1e80d6996ef..1c78f66a89da 100644

drivers/net/ethernet/freescale/Kconfig config FSL_XGMAC_MDIO · line 77

Quoted 7 lines
drivers/net/ethernet/freescale/Kconfig +1 -0
@@ -71,6 +71,7 @@ config FSL_XGMAC_MDIO
 	tristate "Freescale XGMAC MDIO"
 	select PHYLIB
 	depends on OF
+	select MDIO_DEVRES
 	select OF_MDIO
 	help
 	  This driver supports the MDIO bus on the Fman 10G Ethernet MACs, and

Perhaps this is a good idea, but I'd like to mention that I don't think it is strictly necessary as:

Quoted 7 lines

1. FSL_XGMAC_MDIO selects PHYLIB.
2. And PHYLIB selects MDIO_DEVRES.

Likewise for FSL_ENETC, MV643XX_ETH, QCOM_EMAC.

Is there some combination of N/y/m that defeats my logic here? I feel like I am missing something obvious.

I keep getting 0-day randconfig build warning about kernel configuration which don't link. It seems to get worse when we add in support of MAC and PHY LEDs. My guess is, the additional dependencies for LEDs upsets the conflict resolution engine, and it comes out with a different solution. select is a soft dependency. It is more a hint, and can be ignored. And when a randconfig kernel fails to build, MDIO_DEVRES is disabled.

Where possible, i've added a depends on, which is a much stronger dependency. But that can lead to circular dependencies, which kconfig cannot handle. In such cases, i've added selects. Maybe having more selects for a config option will influence it to find a solution which has MDIO_DEVRES enabled?

Quoted 3 lines

I've had this patch in a github tree for a week or more, and 0-day has not yet returned any randconfig build errors. But i've not combined it with the LED code.

Thanks Andrew,

I'm certainly not opposed to this patch.
More curious as to what situations (configs) the problems arise in.

#4 lore raw
In reply to Andrew Lunn
Quoted 48 lines · Andrew Lunn
Quoted 31 lines · Simon Horman
Quoted 19 lines · Andrew Lunn

A number of MDIO drivers make use of devm_mdiobus_alloc_size(). This is only available when CONFIG_MDIO_DEVRES is enabled. Add missing depends or selects, depending on if there are circular dependencies or not. This avoids linker errors, especially for randconfig builds.

---
 drivers/net/ethernet/freescale/Kconfig       | 1 +
 drivers/net/ethernet/freescale/enetc/Kconfig | 1 +
 drivers/net/ethernet/marvell/Kconfig         | 1 +
 drivers/net/ethernet/qualcomm/Kconfig        | 1 +
 drivers/net/mdio/Kconfig                     | 3 +++
 5 files changed, 7 insertions(+)
drivers/net/ethernet/freescale/Kconfig +0 -0
index f1e80d6996ef..1c78f66a89da 100644

drivers/net/ethernet/freescale/Kconfig config FSL_XGMAC_MDIO · line 77

Quoted 7 lines
drivers/net/ethernet/freescale/Kconfig +1 -0
@@ -71,6 +71,7 @@ config FSL_XGMAC_MDIO
 	tristate "Freescale XGMAC MDIO"
 	select PHYLIB
 	depends on OF
+	select MDIO_DEVRES
 	select OF_MDIO
 	help
 	  This driver supports the MDIO bus on the Fman 10G Ethernet MACs, and

Perhaps this is a good idea, but I'd like to mention that I don't think it is strictly necessary as:

Quoted 7 lines

1. FSL_XGMAC_MDIO selects PHYLIB.
2. And PHYLIB selects MDIO_DEVRES.

Likewise for FSL_ENETC, MV643XX_ETH, QCOM_EMAC.

Is there some combination of N/y/m that defeats my logic here? I feel like I am missing something obvious.

I keep getting 0-day randconfig build warning about kernel configuration which don't link. It seems to get worse when we add in support of MAC and PHY LEDs. My guess is, the additional dependencies for LEDs upsets the conflict resolution engine, and it comes out with a different solution. select is a soft dependency. It is more a hint, and can be ignored. And when a randconfig kernel fails to build, MDIO_DEVRES is disabled.

Quoted 6 lines

Where possible, i've added a depends on, which is a much stronger dependency. But that can lead to circular dependencies, which kconfig cannot handle. In such cases, i've added selects. Maybe having more selects for a config option will influence it to find a solution which has MDIO_DEVRES enabled?

I think this approach is ok. Other alternatives to solve the circular dependency are much more invasive.

Quoted 5 lines

I've had this patch in a github tree for a week or more, and 0-day has not yet returned any randconfig build errors. But i've not combined it with the LED code.

Andrew

#6 lore raw
In reply to Andrew Lunn
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Sun, 9 Apr 2023 17:02:04 +0200 you wrote:

A number of MDIO drivers make use of devm_mdiobus_alloc_size(). This is only available when CONFIG_MDIO_DEVRES is enabled. Add missing depends or selects, depending on if there are circular dependencies or not. This avoids linker errors, especially for randconfig builds.

[...]

Here is the summary with links:
- net: ethernet: Add missing depends on MDIO_DEVRES

    https://git.kernel.org/netdev/net-next/c/37f9b2a6c086

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html