From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
Russell King - ARM Linux <linux@armlinux.org.uk>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
David Miller <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH net-next 6/6] net: phy: c45: remove local advertisement parameter from genphy_c45_eee_is_active
Date: Sun, 16 Feb 2025 22:20:07 +0100 [thread overview]
Message-ID: <bd121330-9e28-4bc8-8422-794bd54d561f@gmail.com> (raw)
In-Reply-To: <3caa3151-13ac-44a8-9bb6-20f82563f698@gmail.com>
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>
---
drivers/net/phy/phy-c45.c | 31 +++++++++----------------------
drivers/net/phy/phy.c | 4 ++--
include/linux/phy.h | 3 +--
3 files changed, 12 insertions(+), 26 deletions(-)
diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index fed5fb0ef..37c9a344b 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -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;
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 77b3fb843..b454e31d4 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -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;
@@ -1761,7 +1761,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)
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 26a11a0c7..c0f524579 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -2022,8 +2022,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,
--
2.48.1
next prev parent reply other threads:[~2025-02-16 21:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-16 21:14 [PATCH net-next 0/6] net: phy: improve and simplify EEE handling in phylib Heiner Kallweit
2025-02-16 21:15 ` [PATCH net-next 1/6] net: phy: move definition of phy_is_started before phy_disable_eee_mode Heiner Kallweit
2025-02-16 21:56 ` Andrew Lunn
2025-02-17 8:54 ` Russell King (Oracle)
2025-02-16 21:16 ` [PATCH net-next 2/6] net: phy: improve phy_disable_eee_mode Heiner Kallweit
2025-02-16 22:00 ` Andrew Lunn
2025-02-17 8:54 ` Russell King (Oracle)
2025-02-16 21:17 ` [PATCH net-next 3/6] net: phy: remove disabled EEE modes from advertising_eee in phy_probe Heiner Kallweit
2025-02-16 22:02 ` Andrew Lunn
2025-02-17 8:54 ` Russell King (Oracle)
2025-02-16 21:18 ` [PATCH net-next 4/6] net: phy: c45: Don't silently remove disabled EEE modes any longer when writing advertisement register Heiner Kallweit
2025-02-17 8:55 ` Russell King (Oracle)
2025-02-16 21:19 ` [PATCH net-next 5/6] net: phy: c45: use cached EEE advertisement in genphy_c45_ethtool_get_eee Heiner Kallweit
2025-02-16 22:08 ` Andrew Lunn
2025-02-17 8:55 ` Russell King (Oracle)
2025-02-16 21:20 ` Heiner Kallweit [this message]
2025-02-16 22:09 ` [PATCH net-next 6/6] net: phy: c45: remove local advertisement parameter from genphy_c45_eee_is_active Andrew Lunn
2025-02-17 8:55 ` Russell King (Oracle)
2025-02-19 2:20 ` [PATCH net-next 0/6] net: phy: improve and simplify EEE handling in phylib patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bd121330-9e28-4bc8-8422-794bd54d561f@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).