]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: stmmac: use .mac_select_pcs() interface
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 26 Jan 2022 10:26:25 +0000 (10:26 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Jan 2022 11:20:37 +0000 (11:20 +0000)
Convert stmmac to use the mac_select_pcs() interface rather than using
phylink_set_pcs(). The intention here is to unify the approach for PCS
and eventually to remove phylink_set_pcs().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index 0fd96a98f48903e15e41df4f5c31cbe3d9abe3cd..e4381e13dae5e556e56f491087f2ae1819b422b5 100644 (file)
@@ -936,6 +936,17 @@ static void stmmac_mac_flow_ctrl(struct stmmac_priv *priv, u32 duplex)
                        priv->pause, tx_cnt);
 }
 
+static struct phylink_pcs *stmmac_mac_select_pcs(struct phylink_config *config,
+                                                phy_interface_t interface)
+{
+       struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
+
+       if (!priv->hw->xpcs)
+               return NULL;
+
+       return &priv->hw->xpcs->pcs;
+}
+
 static void stmmac_mac_config(struct phylink_config *config, unsigned int mode,
                              const struct phylink_link_state *state)
 {
@@ -1073,6 +1084,7 @@ static void stmmac_mac_link_up(struct phylink_config *config,
 
 static const struct phylink_mac_ops stmmac_phylink_mac_ops = {
        .validate = phylink_generic_validate,
+       .mac_select_pcs = stmmac_mac_select_pcs,
        .mac_config = stmmac_mac_config,
        .mac_link_down = stmmac_mac_link_down,
        .mac_link_up = stmmac_mac_link_up,
@@ -1209,9 +1221,6 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
        if (IS_ERR(phylink))
                return PTR_ERR(phylink);
 
-       if (priv->hw->xpcs)
-               phylink_set_pcs(phylink, &priv->hw->xpcs->pcs);
-
        priv->phylink = phylink;
        return 0;
 }