net: pcs: xpcs: provide a helper to get the phylink pcs given xpcs
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Fri, 4 Oct 2024 10:20:56 +0000 (11:20 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Oct 2024 11:13:11 +0000 (12:13 +0100)
Provide a helper to provide the pointer to the phylink_pcs struct
given a valid xpcs pointer. This will be necessary when we make
struct dw_xpcs private to pcs-xpcs.c

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/dwmac-intel.c
drivers/net/pcs/pcs-xpcs.c
include/linux/pcs/pcs-xpcs.h

index 83ad7c7935e31e6d7b0668042ee6b526d7e66ddd..48acba5eb178e7bf2ca65c53e6c34c53dc29ae46 100644 (file)
@@ -451,7 +451,7 @@ static struct phylink_pcs *intel_mgbe_select_pcs(struct stmmac_priv *priv,
         * should always be an XPCS. The original code would always
         * return this if present.
         */
-       return &priv->hw->xpcs->pcs;
+       return xpcs_to_phylink_pcs(priv->hw->xpcs);
 }
 
 static int intel_mgbe_common_data(struct pci_dev *pdev,
index 8bde87ab971f6fe5b9300633e0d1d379ce604c69..a7f6d56183a72432f4a40b05ae3900c9bd6031ca 100644 (file)
@@ -132,6 +132,12 @@ xpcs_find_compat(struct dw_xpcs *xpcs, phy_interface_t interface)
        return NULL;
 }
 
+struct phylink_pcs *xpcs_to_phylink_pcs(struct dw_xpcs *xpcs)
+{
+       return &xpcs->pcs;
+}
+EXPORT_SYMBOL_GPL(xpcs_to_phylink_pcs);
+
 int xpcs_get_an_mode(struct dw_xpcs *xpcs, phy_interface_t interface)
 {
        const struct dw_xpcs_compat *compat;
index abda475111d1c971d5f01ccfec435d8a02af16bf..868515f3cc88e9ad990b91ca580966deb8fcdf14 100644 (file)
@@ -64,6 +64,7 @@ struct dw_xpcs {
        bool need_reset;
 };
 
+struct phylink_pcs *xpcs_to_phylink_pcs(struct dw_xpcs *xpcs);
 int xpcs_get_an_mode(struct dw_xpcs *xpcs, phy_interface_t interface);
 void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces);
 int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns,