diff mbox series

net: ethernet: Add missing depends on MDIO_DEVRES

Message ID 20230409150204.2346231-1-andrew@lunn.ch (mailing list archive)
State Accepted
Commit 37f9b2a6c086bb28487a0682b8098f907861c4a1
Delegated to: Netdev Maintainers
Headers show
Series net: ethernet: Add missing depends on MDIO_DEVRES | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 18 this patch: 18
netdev/cc_maintainers warning 8 maintainers not CCed: shenwei.wang@nxp.com lorenzo@kernel.org pabeni@redhat.com sburla@marvell.com edumazet@google.com claudiu.manoil@nxp.com vburru@marvell.com wei.fang@nxp.com
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 18 this patch: 18
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 49 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Andrew Lunn April 9, 2023, 3:02 p.m. UTC
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.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 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(+)

Comments

Simon Horman April 10, 2023, 9:07 a.m. UTC | #1
On Sun, Apr 09, 2023 at 05:02:04PM +0200, Andrew Lunn 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.
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
>  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(+)
> 
> diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
> index f1e80d6996ef..1c78f66a89da 100644
> --- a/drivers/net/ethernet/freescale/Kconfig
> +++ b/drivers/net/ethernet/freescale/Kconfig
> @@ -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.

> diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/ethernet/freescale/enetc/Kconfig
> index 9bc099cf3cb1..4d75e6807e92 100644
> --- a/drivers/net/ethernet/freescale/enetc/Kconfig
> +++ b/drivers/net/ethernet/freescale/enetc/Kconfig
> @@ -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
> diff --git a/drivers/net/ethernet/marvell/Kconfig b/drivers/net/ethernet/marvell/Kconfig
> index f58a1c0144ba..884d64114bff 100644
> --- a/drivers/net/ethernet/marvell/Kconfig
> +++ b/drivers/net/ethernet/marvell/Kconfig
> @@ -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
> diff --git a/drivers/net/ethernet/qualcomm/Kconfig b/drivers/net/ethernet/qualcomm/Kconfig
> index a4434eb38950..9210ff360fdc 100644
> --- a/drivers/net/ethernet/qualcomm/Kconfig
> +++ b/drivers/net/ethernet/qualcomm/Kconfig
> @@ -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
> diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig
> index 90309980686e..9ff2e6f22f3f 100644
> --- a/drivers/net/mdio/Kconfig
> +++ b/drivers/net/mdio/Kconfig
> @@ -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.

> @@ -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
> -- 
> 2.40.0
>
Andrew Lunn April 10, 2023, 12:11 p.m. UTC | #2
On Mon, Apr 10, 2023 at 11:07:58AM +0200, Simon Horman wrote:
> On Sun, Apr 09, 2023 at 05:02:04PM +0200, Andrew Lunn 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.
> > 
> > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> > ---
> >  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(+)
> > 
> > diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
> > index f1e80d6996ef..1c78f66a89da 100644
> > --- a/drivers/net/ethernet/freescale/Kconfig
> > +++ b/drivers/net/ethernet/freescale/Kconfig
> > @@ -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.

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
Simon Horman April 10, 2023, 12:56 p.m. UTC | #3
On Mon, Apr 10, 2023 at 02:11:39PM +0200, Andrew Lunn wrote:
> On Mon, Apr 10, 2023 at 11:07:58AM +0200, Simon Horman wrote:
> > On Sun, Apr 09, 2023 at 05:02:04PM +0200, Andrew Lunn 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.
> > > 
> > > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> > > ---
> > >  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(+)
> > > 
> > > diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
> > > index f1e80d6996ef..1c78f66a89da 100644
> > > --- a/drivers/net/ethernet/freescale/Kconfig
> > > +++ b/drivers/net/ethernet/freescale/Kconfig
> > > @@ -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.
> 
> 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.

Thanks Andrew,

I'm certainly not opposed to this patch.
More curious as to what situations (configs) the problems arise in.
Jacob Keller April 12, 2023, 10:52 p.m. UTC | #4
On 4/10/2023 5:11 AM, Andrew Lunn wrote:
> On Mon, Apr 10, 2023 at 11:07:58AM +0200, Simon Horman wrote:
>> On Sun, Apr 09, 2023 at 05:02:04PM +0200, Andrew Lunn 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.
>>>
>>> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
>>> ---
>>>  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(+)
>>>
>>> diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
>>> index f1e80d6996ef..1c78f66a89da 100644
>>> --- a/drivers/net/ethernet/freescale/Kconfig
>>> +++ b/drivers/net/ethernet/freescale/Kconfig
>>> @@ -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.
> 
> 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 think this approach is ok. Other alternatives to solve the circular
dependency are much more invasive.

> 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
Jacob Keller April 12, 2023, 10:53 p.m. UTC | #5
On 4/9/2023 8:02 AM, Andrew Lunn 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.
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
patchwork-bot+netdevbpf@kernel.org April 13, 2023, 3:50 a.m. UTC | #6
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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.
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> 
> [...]

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!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
index f1e80d6996ef..1c78f66a89da 100644
--- a/drivers/net/ethernet/freescale/Kconfig
+++ b/drivers/net/ethernet/freescale/Kconfig
@@ -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
diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/ethernet/freescale/enetc/Kconfig
index 9bc099cf3cb1..4d75e6807e92 100644
--- a/drivers/net/ethernet/freescale/enetc/Kconfig
+++ b/drivers/net/ethernet/freescale/enetc/Kconfig
@@ -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
diff --git a/drivers/net/ethernet/marvell/Kconfig b/drivers/net/ethernet/marvell/Kconfig
index f58a1c0144ba..884d64114bff 100644
--- a/drivers/net/ethernet/marvell/Kconfig
+++ b/drivers/net/ethernet/marvell/Kconfig
@@ -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
diff --git a/drivers/net/ethernet/qualcomm/Kconfig b/drivers/net/ethernet/qualcomm/Kconfig
index a4434eb38950..9210ff360fdc 100644
--- a/drivers/net/ethernet/qualcomm/Kconfig
+++ b/drivers/net/ethernet/qualcomm/Kconfig
@@ -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
diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig
index 90309980686e..9ff2e6f22f3f 100644
--- a/drivers/net/mdio/Kconfig
+++ b/drivers/net/mdio/Kconfig
@@ -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