diff mbox series

net: stmmac: Fix build without PCS_LYNX

Message ID 7b36ac43778b41831debd5c30b5b37d268512195.1686039915.git.geert+renesas@glider.be (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: stmmac: Fix build without PCS_LYNX | 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

Geert Uytterhoeven June 6, 2023, 8:27 a.m. UTC
If STMMAC_ETH=y, but PCS_LYNX=n (e.g. shmobile_defconfig):

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

As pcs_lynx is used only on dwmac_socfpga, fix this by adding a check
for PCS_LYNX to the cleanup path in the generic driver.

Fixes: 5d1f3fe7d2d54d04 ("net: stmmac: dwmac-sogfpga: use the lynx pcs driver")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Geert Uytterhoeven June 6, 2023, 9:30 a.m. UTC | #1
On Tue, Jun 6, 2023 at 10:27 AM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> If STMMAC_ETH=y, but PCS_LYNX=n (e.g. shmobile_defconfig):
>
>     arm-linux-gnueabihf-ld: drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.o: in function `stmmac_mdio_unregister':
>     stmmac_mdio.c:(.text+0xfbc): undefined reference to `lynx_pcs_destroy'
>
> As pcs_lynx is used only on dwmac_socfpga, fix this by adding a check
> for PCS_LYNX to the cleanup path in the generic driver.
>
> Fixes: 5d1f3fe7d2d54d04 ("net: stmmac: dwmac-sogfpga: use the lynx pcs driver")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> index c784a6731f08e108..53ed59d732210814 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> @@ -665,7 +665,7 @@ int stmmac_mdio_unregister(struct net_device *ndev)
>         if (priv->hw->xpcs)
>                 xpcs_destroy(priv->hw->xpcs);
>
> -       if (priv->hw->lynx_pcs)
> +       if (IS_ENABLED(CONFIG_PCS_LYNX) && priv->hw->lynx_pcs)
>                 lynx_pcs_destroy(priv->hw->lynx_pcs);
>
>         mdiobus_unregister(priv->mii);

As pointed out by Arnd, this doesn't work when PCS_LYNX is a loadable
module and STMMAC is built-in:
https://lore.kernel.org/r/11bd37e9-c62e-46ba-9456-8e3b353df28f@app.fastmail.com

Gr{oetje,eeting}s,

                        Geert
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index c784a6731f08e108..53ed59d732210814 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -665,7 +665,7 @@  int stmmac_mdio_unregister(struct net_device *ndev)
 	if (priv->hw->xpcs)
 		xpcs_destroy(priv->hw->xpcs);
 
-	if (priv->hw->lynx_pcs)
+	if (IS_ENABLED(CONFIG_PCS_LYNX) && priv->hw->lynx_pcs)
 		lynx_pcs_destroy(priv->hw->lynx_pcs);
 
 	mdiobus_unregister(priv->mii);