Subject: Re: [PATCH] net: lan743x: LAN743X selects FIXED_PHY to resolve a link error

From: Simon Horman <[email-masked]>
Date: Mon, 20 Feb 2023 07:46:13 +0100

On Mon, Feb 20, 2023 at 02:19:34AM +0100, Andrew Lunn wrote:
> On Sun, Feb 19, 2023 at 07:16:07PM +0100, Simon Horman wrote:
> > On Sun, Feb 19, 2023 at 10:03:21AM -0500, Tom Rix wrote:
> > > A rand config causes this link error
> > > drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
> > > drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'
> > > 
> > > lan743x_netdev_open is controlled by LAN743X
> > > fixed_phy_register is controlled by FIXED_PHY
> > > 
> > > So LAN743X should also select FIXED_PHY
> > > 
> > > Signed-off-by: Tom Rix <[email-masked]>
> > 
> > Hi Tom,
> > 
> > I am a little confused by this.
> > 
> > I did manage to cook up a config with LAN743X=m and FIXED_PHY not set.
> > But I do not see a build failure, and I believe that is because
> > when FIXED_PHY is not set then a stub version of fixed_phy_register(),
> > defined as static inline in include/linux/phy_fixed.h, is used.
> > 
> > Ref: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/include/linux/phy_fixed.h?h=main&id=675f176b4dcc2b75adbcea7ba0e9a649527f53bd#n42
> 
> I'n guessing, but it could be that LAN743X is built in, and FIXED_PHY
> is a module? What might be needed is
> 
> depends on FIXED_PHY || FIXED_PHY=n

Thanks Andrew,

LAN743X=y and FIXED_PHY=m does indeed produce the problem that Tom
describes. And his patch does appear to resolve the problem.

Unfortunately your proposed solution seems to run foul of a complex
dependency situation.

$ make
...
drivers/net/ethernet/microchip/Kconfig:45:error: recursive dependency detected!
drivers/net/ethernet/microchip/Kconfig:45:	symbol LAN743X depends on FIXED_PHY
drivers/net/phy/Kconfig:48:	symbol FIXED_PHY depends on PHYLIB
drivers/net/phy/Kconfig:16:	symbol PHYLIB is selected by LAN743X
For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"