diff mbox series

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

Message ID 6e5cd4ab-28bb-4d82-b449-fec85f3d1e8a@gmail.com (mailing list archive)
State Accepted
Commit 3cc97d2fa9876d30ff5a2665211cf11daf01beeb
Delegated to: Netdev Maintainers
Headers show
Series net: phy: remove genphy_config_eee_advert | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3 this patch: 3
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 3 this patch: 3
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 4 this patch: 4
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-11-07--12-00 (tests: 787)

Commit Message

Heiner Kallweit Nov. 6, 2024, 8:24 p.m. UTC
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.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/bcm-phy-lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrew Lunn Nov. 7, 2024, 2:02 p.m. UTC | #1
On Wed, Nov 06, 2024 at 09:24:18PM +0100, Heiner Kallweit wrote:
> 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:

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Florian Fainelli Nov. 7, 2024, 5:48 p.m. UTC | #2
On 11/6/24 12:24, Heiner Kallweit wrote:
> 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.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>

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

Patch

diff --git a/drivers/net/phy/bcm-phy-lib.c b/drivers/net/phy/bcm-phy-lib.c
index 6c52f7dda..a923ccc52 100644
--- a/drivers/net/phy/bcm-phy-lib.c
+++ b/drivers/net/phy/bcm-phy-lib.c
@@ -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);