Skip to contentSkip to conversation

net: phy: remove genphy_config_eee_advert

PATCH Applied Heiner Kallweit 4 participants 13 messages Nov 6, 2024 – Nov 8, 2024

Subsystems (4)
lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

cover net: phy: remove genphy_config_eee_advert

This series removes genphy_config_eee_advert().

Note: The change to bcm_config_lre_aneg() is compile-tested only as I don't have supported hardware.

Heiner Kallweit (4):
net: phy: make genphy_c45_write_eee_adv() static
net: phy: export genphy_c45_an_config_eee_aneg
net: phy: broadcom: use genphy_c45_an_config_eee_aneg in
bcm_config_lre_aneg
net: phy: remove genphy_config_eee_advert

 drivers/net/phy/bcm-phy-lib.c |  2 +-
 drivers/net/phy/phy-c45.c     |  4 +++-
 drivers/net/phy/phy_device.c  | 23 -----------------------
 include/linux/phy.h           |  2 --
 4 files changed, 4 insertions(+), 27 deletions(-)
Signature · 1 line
2.47.0
author maintainer
#1 lore raw

PATCH 1/4 net: phy: make genphy_c45_write_eee_adv() static

genphy_c45_write_eee_adv() isn't used outside phy-c45.c, so make it static.

---
 drivers/net/phy/phy-c45.c | 3 ++-
 include/linux/phy.h       | 1 -
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/phy-c45.c +2 -1
index 5695935fd..6e7198794 100644
@@ -680,7 +680,8 @@ EXPORT_SYMBOL_GPL(genphy_c45_read_mdix);
  * @phydev: target phy_device struct
  * @adv: the linkmode advertisement settings
  */
-int genphy_c45_write_eee_adv(struct phy_device *phydev, unsigned long *adv)
+static int genphy_c45_write_eee_adv(struct phy_device *phydev,
+				    unsigned long *adv)
 {
 	int val, changed = 0;
 
include/linux/phy.h +0 -1
index 0a0985150..517f6e0d3 100644
@@ -1954,7 +1954,6 @@ int genphy_c45_ethtool_get_eee(struct phy_device *phydev,
 			       struct ethtool_keee *data);
 int genphy_c45_ethtool_set_eee(struct phy_device *phydev,
 			       struct ethtool_keee *data);
-int genphy_c45_write_eee_adv(struct phy_device *phydev, unsigned long *adv);
 int genphy_c45_an_config_eee_aneg(struct phy_device *phydev);
 int genphy_c45_read_eee_adv(struct phy_device *phydev, unsigned long *adv);
 
Signature · 1 line
2.47.0
author maintainer
#4 lore raw

PATCH 2/4 net: phy: export genphy_c45_an_config_eee_aneg

In reply to Heiner Kallweit

We'll use this function in bcm_config_lre_aneg(), therefore export it.

---
 drivers/net/phy/phy-c45.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/phy/phy-c45.c +1 -0
index 6e7198794..dabd90a3c 100644
@@ -951,6 +951,7 @@ int genphy_c45_an_config_eee_aneg(struct phy_device *phydev)
 
 	return genphy_c45_write_eee_adv(phydev, phydev->advertising_eee);
 }
+EXPORT_SYMBOL_GPL(genphy_c45_an_config_eee_aneg);
 
 /**
  * genphy_c45_pma_baset1_read_abilities - read supported baset1 link modes from PMA
Signature · 1 line
2.47.0
author maintainer
#6 lore raw

PATCH 3/4 net: phy: broadcom: use genphy_c45_an_config_eee_aneg in bcm_config_lre_aneg

In reply to Heiner Kallweit

bcm_config_lre_aneg() is the only user of genphy_config_eee_advert(), therefore use genphy_c45_an_config_eee_aneg() instead. The resulting functionality is equivalent, and bcm_config_lre_aneg() follows the structure of __genphy_config_aneg().
In a follow-up step genphy_config_eee_advert() can be removed.

Note: We preserve the current behavior to ignore errors.

---
 drivers/net/phy/bcm-phy-lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/bcm-phy-lib.c +1 -1
index 6c52f7dda..a923ccc52 100644
@@ -1137,7 +1137,7 @@ int bcm_config_lre_aneg(struct phy_device *phydev, bool changed)
 {
 	int err;
 
-	if (genphy_config_eee_advert(phydev))
+	if (genphy_c45_an_config_eee_aneg(phydev) > 0)
 		changed = true;
 
 	err = bcm_setup_lre_master_slave(phydev);
Signature · 1 line
2.47.0
maintainer Reviewed-by on v1 3/4
#7 lore raw

Re: [PATCH net-next 3/4] net: phy: broadcom: use genphy_c45_an_config_eee_aneg in bcm_config_lre_aneg

Quoted 4 lines · Heiner Kallweit

bcm_config_lre_aneg() is the only user of genphy_config_eee_advert(), therefore use genphy_c45_an_config_eee_aneg() instead. The resulting functionality is equivalent, and bcm_config_lre_aneg() follows the structure of __genphy_config_aneg().

I think the commit message could be clearer. Just looking at genphy_config_eee_advert() and genphy_c45_an_config_eee_aneg() it is not clear they are equivalent. You need to dig into genphy_c45_write_eee_adv() where phydev->eee_broken_modes comes in, and they start to look similar.

It does however look like this will work, so:

Andrew

maintainer Reviewed-by on v1 3/4
#8 lore raw

Re: [PATCH net-next 3/4] net: phy: broadcom: use genphy_c45_an_config_eee_aneg in bcm_config_lre_aneg

In reply to Heiner Kallweit
Quoted 9 lines · Heiner Kallweit

bcm_config_lre_aneg() is the only user of genphy_config_eee_advert(), therefore use genphy_c45_an_config_eee_aneg() instead. The resulting functionality is equivalent, and bcm_config_lre_aneg() follows the structure of __genphy_config_aneg().
In a follow-up step genphy_config_eee_advert() can be removed.

Note: We preserve the current behavior to ignore errors.

Thanks, this also makes the driver future proof with respect to 2.5/5G modes which was not the case before.

Signature · 1 line
Florian
author maintainer
#9 lore raw

PATCH 4/4 net: phy: remove genphy_config_eee_advert

In reply to Heiner Kallweit

bcm_config_lre_aneg() doesn't use genphy_config_eee_advert() any longer. As this was the only user, we can remove genphy_config_eee_advert() now.

---
 drivers/net/phy/phy_device.c | 23 -----------------------
 include/linux/phy.h          |  1 -
 2 files changed, 24 deletions(-)
drivers/net/phy/phy_device.c +0 -23
index 563497a32..bc24c9f27 100644
@@ -2239,29 +2239,6 @@ static int genphy_c37_config_advert(struct phy_device *phydev)
 				  adv);
 }
 
-/**
- * genphy_config_eee_advert - disable unwanted eee mode advertisement
- * @phydev: target phy_device struct
- *
- * Description: Writes MDIO_AN_EEE_ADV after disabling unsupported energy
- *   efficent ethernet modes. Returns 0 if the PHY's advertisement hasn't
- *   changed, and 1 if it has changed.
- */
-int genphy_config_eee_advert(struct phy_device *phydev)
-{
-	int err;
-
-	/* Nothing to disable */
-	if (!phydev->eee_broken_modes)
-		return 0;
-
-	err = phy_modify_mmd_changed(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV,
-				     phydev->eee_broken_modes, 0);
-	/* If the call failed, we assume that EEE is not supported */
-	return err < 0 ? 0 : err;
-}
-EXPORT_SYMBOL(genphy_config_eee_advert);
-
 /**
  * genphy_setup_forced - configures/forces speed/duplex from @phydev
  * @phydev: target phy_device struct
include/linux/phy.h +0 -1
index 517f6e0d3..d1a4f3f86 100644
@@ -1886,7 +1886,6 @@ int genphy_read_abilities(struct phy_device *phydev);
 int genphy_setup_forced(struct phy_device *phydev);
 int genphy_restart_aneg(struct phy_device *phydev);
 int genphy_check_and_restart_aneg(struct phy_device *phydev, bool restart);
-int genphy_config_eee_advert(struct phy_device *phydev);
 int __genphy_config_aneg(struct phy_device *phydev, bool changed);
 int genphy_aneg_done(struct phy_device *phydev);
 int genphy_update_link(struct phy_device *phydev);
Signature · 1 line
2.47.0
maintainer Reviewed-by on v1 4/4
#10 lore raw
Quoted 2 lines · Heiner Kallweit

bcm_config_lre_aneg() doesn't use genphy_config_eee_advert() any longer. As this was the only user, we can remove genphy_config_eee_advert() now.

The naming of genphy_config_eee_advert() is also quiet bad, so it is good to see it go for that reason.

Andrew

#12 lore raw
In reply to Heiner Kallweit
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 5 lines · On Wed, 6 Nov 2024 21:19:02 +0100 you wrote:

This series removes genphy_config_eee_advert().

Note: The change to bcm_config_lre_aneg() is compile-tested only as I don't have supported hardware.

Quoted 8 lines

Heiner Kallweit (4):
net: phy: make genphy_c45_write_eee_adv() static
net: phy: export genphy_c45_an_config_eee_aneg
net: phy: broadcom: use genphy_c45_an_config_eee_aneg in
bcm_config_lre_aneg
net: phy: remove genphy_config_eee_advert

[...]

Here is the summary with links:
- [net-next,1/4] net: phy: make genphy_c45_write_eee_adv() static

    https://git.kernel.org/netdev/net-next/c/9c477088b60d
  - [net-next,2/4] net: phy: export genphy_c45_an_config_eee_aneg
    https://git.kernel.org/netdev/net-next/c/bcfb95c9898a
  - [net-next,3/4] net: phy: broadcom: use genphy_c45_an_config_eee_aneg in bcm_config_lre_aneg
    https://git.kernel.org/netdev/net-next/c/3cc97d2fa987
  - [net-next,4/4] net: phy: remove genphy_config_eee_advert
    https://git.kernel.org/netdev/net-next/c/db73835f54fc

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html