diff mbox series

[net-next] tg3: simplify tg3_phy_autoneg_cfg

Message ID 9fcf20f5-7763-4bde-8ed8-fc81722ad509@gmail.com (mailing list archive)
State Accepted
Commit ebb0346a117f96fe732791289628964276d51b7d
Delegated to: Netdev Maintainers
Headers show
Series [net-next] tg3: simplify tg3_phy_autoneg_cfg | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
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: 947 this patch: 947
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 957 this patch: 957
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: 968 this patch: 968
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 25 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-02-21--00-00 (tests: 1452)

Commit Message

Heiner Kallweit Feb. 18, 2024, 6:04 p.m. UTC
Make use of ethtool_adv_to_mmd_eee_adv_t() to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/broadcom/tg3.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

Comments

Simon Horman Feb. 19, 2024, 7:37 p.m. UTC | #1
On Sun, Feb 18, 2024 at 07:04:42PM +0100, Heiner Kallweit wrote:
> 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>
Kalesh Anakkur Purayil Feb. 20, 2024, 1:54 a.m. UTC | #2
On Sun, Feb 18, 2024 at 11:34 PM Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> Make use of ethtool_adv_to_mmd_eee_adv_t() to simplify the code.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

LGTM
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
>
> ---
>  drivers/net/ethernet/broadcom/tg3.c | 17 ++++-------------
>  1 file changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index 7a07c5216..62ff4381a 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;
> --
> 2.43.2
>
>
Andrew Lunn Feb. 20, 2024, 2:48 p.m. UTC | #3
On Sun, Feb 18, 2024 at 07:04:42PM +0100, Heiner Kallweit wrote:
> Make use of ethtool_adv_to_mmd_eee_adv_t() to simplify the code.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

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

    Andrew
Michael Chan Feb. 20, 2024, 7:31 p.m. UTC | #4
On Sun, Feb 18, 2024 at 10:04 AM Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> Make use of ethtool_adv_to_mmd_eee_adv_t() to simplify the code.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Thanks.
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
patchwork-bot+netdevbpf@kernel.org Feb. 21, 2024, 11:20 a.m. UTC | #5
Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Sun, 18 Feb 2024 19:04:42 +0100 you wrote:
> Make use of ethtool_adv_to_mmd_eee_adv_t() to simplify the code.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/net/ethernet/broadcom/tg3.c | 17 ++++-------------
>  1 file changed, 4 insertions(+), 13 deletions(-)

Here is the summary with links:
  - [net-next] tg3: simplify tg3_phy_autoneg_cfg
    https://git.kernel.org/netdev/net-next/c/ebb0346a117f

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 7a07c5216..62ff4381a 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;