]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: phy: c45: remove local advertisement parameter from genphy_c45_eee_is_active
authorHeiner Kallweit <hkallweit1@gmail.com>
Sun, 16 Feb 2025 21:20:07 +0000 (22:20 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 19 Feb 2025 02:07:09 +0000 (18:07 -0800)
After the last user has gone, we can remove the local advertisement
parameter from genphy_c45_eee_is_active.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/bd121330-9e28-4bc8-8422-794bd54d561f@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/phy-c45.c
drivers/net/phy/phy.c
include/linux/phy.h

index fed5fb0ef321e7eb8d762d5d3439630d649732c4..37c9a344bf4a30306d4467083cba3a24e05b0478 100644 (file)
@@ -1464,42 +1464,29 @@ EXPORT_SYMBOL_GPL(genphy_c45_plca_get_status);
 /**
  * genphy_c45_eee_is_active - get EEE status
  * @phydev: target phy_device struct
- * @adv: variable to store advertised linkmodes
  * @lp: variable to store LP advertised linkmodes
  *
- * Description: this function will read local and link partner PHY
- * advertisements. Compare them return current EEE state.
+ * Description: this function will read link partner PHY advertisement
+ * and compare it to local advertisement to return current EEE state.
  */
-int genphy_c45_eee_is_active(struct phy_device *phydev, unsigned long *adv,
-                            unsigned long *lp)
+int genphy_c45_eee_is_active(struct phy_device *phydev, unsigned long *lp)
 {
-       __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp_adv) = {};
        __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp_lp) = {};
        __ETHTOOL_DECLARE_LINK_MODE_MASK(common);
-       bool eee_active;
        int ret;
 
-       ret = genphy_c45_read_eee_adv(phydev, tmp_adv);
-       if (ret)
-               return ret;
-
        ret = genphy_c45_read_eee_lpa(phydev, tmp_lp);
        if (ret)
                return ret;
 
-       linkmode_and(common, tmp_adv, tmp_lp);
-       if (!linkmode_empty(tmp_adv) && !linkmode_empty(common))
-               eee_active = phy_check_valid(phydev->speed, phydev->duplex,
-                                            common);
-       else
-               eee_active = false;
-
-       if (adv)
-               linkmode_copy(adv, tmp_adv);
        if (lp)
                linkmode_copy(lp, tmp_lp);
 
-       return eee_active;
+       linkmode_and(common, phydev->advertising_eee, tmp_lp);
+       if (linkmode_empty(common))
+               return 0;
+
+       return phy_check_valid(phydev->speed, phydev->duplex, common);
 }
 EXPORT_SYMBOL(genphy_c45_eee_is_active);
 
@@ -1516,7 +1503,7 @@ int genphy_c45_ethtool_get_eee(struct phy_device *phydev,
 {
        int ret;
 
-       ret = genphy_c45_eee_is_active(phydev, NULL, data->lp_advertised);
+       ret = genphy_c45_eee_is_active(phydev, data->lp_advertised);
        if (ret < 0)
                return ret;
 
index f2086b0b7b76ea6a32e8cb6b3616a4653fec0c90..831b368396277c402328626930b474d8f6e2349c 100644 (file)
@@ -1031,7 +1031,7 @@ static int phy_check_link_status(struct phy_device *phydev)
        if (phydev->link && phydev->state != PHY_RUNNING) {
                phy_check_downshift(phydev);
                phydev->state = PHY_RUNNING;
-               err = genphy_c45_eee_is_active(phydev, NULL, NULL);
+               err = genphy_c45_eee_is_active(phydev, NULL);
                phydev->eee_active = err > 0;
                phydev->enable_tx_lpi = phydev->eee_cfg.tx_lpi_enabled &&
                                        phydev->eee_active;
@@ -1780,7 +1780,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
        if (!phydev->drv)
                return -EIO;
 
-       ret = genphy_c45_eee_is_active(phydev, NULL, NULL);
+       ret = genphy_c45_eee_is_active(phydev, NULL);
        if (ret < 0)
                return ret;
        if (!ret)
index 0d5da01d275c43b518625a779ee76a27448a50b7..584710e084eb642da305bf6c0cb94a5375f038a6 100644 (file)
@@ -2032,8 +2032,7 @@ int genphy_c45_plca_set_cfg(struct phy_device *phydev,
                            const struct phy_plca_cfg *plca_cfg);
 int genphy_c45_plca_get_status(struct phy_device *phydev,
                               struct phy_plca_status *plca_st);
-int genphy_c45_eee_is_active(struct phy_device *phydev, unsigned long *adv,
-                            unsigned long *lp);
+int genphy_c45_eee_is_active(struct phy_device *phydev, unsigned long *lp);
 int genphy_c45_ethtool_get_eee(struct phy_device *phydev,
                               struct ethtool_keee *data);
 int genphy_c45_ethtool_set_eee(struct phy_device *phydev,