diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2024-02-18 19:04:42 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-02-21 11:16:12 +0000 |
commit | ebb0346a117f96fe732791289628964276d51b7d (patch) | |
tree | 096a915e0dacf34d944fa20b746e32276f01011a /drivers/net/ethernet/broadcom/tg3.c | |
parent | 8306ee08c0ff1c78672bcc645544f26f4d652cca (diff) |
tg3: simplify tg3_phy_autoneg_cfg
Make use of ethtool_adv_to_mmd_eee_adv_t() to simplify the code.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/tg3.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index ed93149f3b67..eee759054aad 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -4354,21 +4354,12 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl) if (!err) { u32 err2; - val = 0; - /* Advertise 100-BaseTX EEE ability */ - if (advertise & ADVERTISED_100baseT_Full) - val |= MDIO_AN_EEE_ADV_100TX; - /* Advertise 1000-BaseT EEE ability */ - if (advertise & ADVERTISED_1000baseT_Full) - val |= MDIO_AN_EEE_ADV_1000T; - - if (!tp->eee.eee_enabled) { + if (!tp->eee.eee_enabled) val = 0; - linkmode_zero(tp->eee.advertised); - } else { - mii_eee_cap1_mod_linkmode_t(tp->eee.advertised, val); - } + else + val = ethtool_adv_to_mmd_eee_adv_t(advertise); + mii_eee_cap1_mod_linkmode_t(tp->eee.advertised, val); err = tg3_phy_cl45_write(tp, MDIO_MMD_AN, MDIO_AN_EEE_ADV, val); if (err) val = 0; |