diff mbox series

[1/2] stmmac: fix pcs_lynx link failure

Message ID 20230607135638.1341101-1-arnd@kernel.org (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series [1/2] stmmac: fix pcs_lynx link failure | 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: 8 this patch: 8
netdev/cc_maintainers success CCed 13 of 13 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
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 Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch warning WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: 5d1f3fe7d2d5 ("net: stmmac: dwmac-sogfpga: use the lynx pcs driver")'
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Arnd Bergmann June 7, 2023, 1:56 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

The mdio code in stmmac now directly links into both the lynx_pcs and
the xpcs device drivers, but the lynx_pcs dependency is only enforced
for the altera variant of stmmac, which is the one that actually uses it.

Building stmmac for a non-altera platform therefore causes a link
failure:

arm-linux-gnueabi-ld: drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.o: in function `stmmac_mdio_unregister':
stmmac_mdio.c:(.text+0x1418): undefined reference to `lynx_pcs_destroy'

I've tried to come up with a patch that moves this dependency back into
the dwmac-socfpga.c file, but there was no easy and obvious way to
do this. It also seems that this would not be a proper solution, but
instead there should be a real abstraction for pcs drivers that lets
device drivers handle this transparently.

As the lynx_pcs driver is tiny, it appears that we can just avoid the
link error by always forcing it to be built when the stmmac driver
is, even for non-altera platforms. This matches what we already do
for the xpcs variant that is used by the intel and tegra variants of
stmmac.

Fixes: 5d1f3fe7d2d54 ("net: stmmac: dwmac-sogfpga: use the lynx pcs driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Russell King (Oracle) June 7, 2023, 2:12 p.m. UTC | #1
On Wed, Jun 07, 2023 at 03:56:32PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The mdio code in stmmac now directly links into both the lynx_pcs and
> the xpcs device drivers, but the lynx_pcs dependency is only enforced
> for the altera variant of stmmac, which is the one that actually uses it.
> 
> Building stmmac for a non-altera platform therefore causes a link
> failure:
> 
> arm-linux-gnueabi-ld: drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.o: in function `stmmac_mdio_unregister':
> stmmac_mdio.c:(.text+0x1418): undefined reference to `lynx_pcs_destroy'
> 
> I've tried to come up with a patch that moves this dependency back into
> the dwmac-socfpga.c file, but there was no easy and obvious way to
> do this. It also seems that this would not be a proper solution, but
> instead there should be a real abstraction for pcs drivers that lets
> device drivers handle this transparently.

There is already a patch set on netdev fixing this properly.
Simon Horman June 7, 2023, 3:52 p.m. UTC | #2
On Wed, Jun 07, 2023 at 03:12:00PM +0100, Russell King (Oracle) wrote:
> On Wed, Jun 07, 2023 at 03:56:32PM +0200, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> > 
> > The mdio code in stmmac now directly links into both the lynx_pcs and
> > the xpcs device drivers, but the lynx_pcs dependency is only enforced
> > for the altera variant of stmmac, which is the one that actually uses it.
> > 
> > Building stmmac for a non-altera platform therefore causes a link
> > failure:
> > 
> > arm-linux-gnueabi-ld: drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.o: in function `stmmac_mdio_unregister':
> > stmmac_mdio.c:(.text+0x1418): undefined reference to `lynx_pcs_destroy'
> > 
> > I've tried to come up with a patch that moves this dependency back into
> > the dwmac-socfpga.c file, but there was no easy and obvious way to
> > do this. It also seems that this would not be a proper solution, but
> > instead there should be a real abstraction for pcs drivers that lets
> > device drivers handle this transparently.
> 
> There is already a patch set on netdev fixing this properly.

Yes, let's focus on the solution proposed here:
https://lore.kernel.org/netdev/20230607135941.407054-1-maxime.chevallier@bootlin.com/T/#t
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index 5583f0b055ec7..fa956f2081a53 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -5,6 +5,7 @@  config STMMAC_ETH
 	depends on PTP_1588_CLOCK_OPTIONAL
 	select MII
 	select PCS_XPCS
+	select PCS_LYNX
 	select PAGE_POOL
 	select PHYLINK
 	select CRC32
@@ -160,7 +161,6 @@  config DWMAC_SOCFPGA
 	select MFD_SYSCON
 	select MDIO_REGMAP
 	select REGMAP_MMIO
-	select PCS_LYNX
 	help
 	  Support for ethernet controller on Altera SOCFPGA