Netdev Archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: stmmac: fix NPD with phylink_set_pcs if there is no MDIO bus
@ 2021-06-08 13:10 Vladimir Oltean
  0 siblings, 0 replies; only message in thread
From: Vladimir Oltean @ 2021-06-08 13:10 UTC (permalink / raw
  To: Jakub Kicinski, David S. Miller, netdev
  Cc: Wong Vee Khee, Ong Boon Leong, Michael Sit Wei Hong,
	Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, Jose Abreu,
	Maxime Coquelin, Heiner Kallweit, Russell King - ARM Linux admin,
	Florian Fainelli, Andrew Lunn, kernel-janitors, Vladimir Oltean,
	Dan Carpenter

From: Vladimir Oltean <vladimir.oltean@nxp.com>

priv->plat->mdio_bus_data is optional, some platforms may not set it,
however we proceed to look straight at priv->plat->mdio_bus_data->has_xpcs.

Since the xpcs is instantiated based on the has_xpcs property, we can
avoid looking at the priv->plat->mdio_bus_data structure altogether and
just check for the presence of the xpcs pointer.

Fixes: 11059740e616 ("net: pcs: xpcs: convert to phylink_pcs_ops")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index dd2fb851c693..ec060ce9bcf2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1238,11 +1238,8 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
 	if (IS_ERR(phylink))
 		return PTR_ERR(phylink);
 
-	if (mdio_bus_data->has_xpcs) {
-		struct mdio_xpcs_args *xpcs = priv->hw->xpcs;
-
-		phylink_set_pcs(phylink, &xpcs->pcs);
-	}
+	if (priv->hw->xpcs)
+		phylink_set_pcs(phylink, &priv->hw->xpcs->pcs);
 
 	priv->phylink = phylink;
 	return 0;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-08 13:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-08 13:10 [PATCH net-next] net: stmmac: fix NPD with phylink_set_pcs if there is no MDIO bus Vladimir Oltean

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).