netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: realtek: use generic MDIO helpers to simplify the code
@ 2024-02-08  6:59 Heiner Kallweit
  2024-02-08 15:07 ` Andrew Lunn
  2024-02-09 22:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Heiner Kallweit @ 2024-02-08  6:59 UTC (permalink / raw)
  To: Andrew Lunn, Russell King - ARM Linux, Jakub Kicinski,
	David Miller, Paolo Abeni, Eric Dumazet
  Cc: netdev@vger.kernel.org

Use generic MDIO helpers to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/realtek.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index 962df2b83..481c79fbd 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -680,14 +680,7 @@ static int rtl822x_config_aneg(struct phy_device *phydev)
 	int ret = 0;
 
 	if (phydev->autoneg == AUTONEG_ENABLE) {
-		u16 adv = 0;
-
-		if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
-				      phydev->advertising))
-			adv |= MDIO_AN_10GBT_CTRL_ADV2_5G;
-		if (linkmode_test_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
-				      phydev->advertising))
-			adv |= MDIO_AN_10GBT_CTRL_ADV5G;
+		u16 adv = linkmode_adv_to_mii_10gbt_adv_t(phydev->advertising);
 
 		ret = phy_modify_paged_changed(phydev, 0xa5d, 0x12,
 					       MDIO_AN_10GBT_CTRL_ADV2_5G |
@@ -710,15 +703,8 @@ static int rtl822x_read_status(struct phy_device *phydev)
 		if (lpadv < 0)
 			return lpadv;
 
-		linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT,
-				 phydev->lp_advertising,
-				 lpadv & MDIO_AN_10GBT_STAT_LP10G);
-		linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
-				 phydev->lp_advertising,
-				 lpadv & MDIO_AN_10GBT_STAT_LP5G);
-		linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
-				 phydev->lp_advertising,
-				 lpadv & MDIO_AN_10GBT_STAT_LP2_5G);
+		mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising,
+						  lpadv);
 	}
 
 	ret = genphy_read_status(phydev);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: phy: realtek: use generic MDIO helpers to simplify the code
  2024-02-08  6:59 [PATCH net-next] net: phy: realtek: use generic MDIO helpers to simplify the code Heiner Kallweit
@ 2024-02-08 15:07 ` Andrew Lunn
  2024-02-09 22:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2024-02-08 15:07 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Russell King - ARM Linux, Jakub Kicinski, David Miller,
	Paolo Abeni, Eric Dumazet, netdev@vger.kernel.org

On Thu, Feb 08, 2024 at 07:59:18AM +0100, Heiner Kallweit wrote:
> Use generic MDIO helpers to simplify the code.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

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

    Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: phy: realtek: use generic MDIO helpers to simplify the code
  2024-02-08  6:59 [PATCH net-next] net: phy: realtek: use generic MDIO helpers to simplify the code Heiner Kallweit
  2024-02-08 15:07 ` Andrew Lunn
@ 2024-02-09 22:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-09 22:30 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: andrew, linux, kuba, davem, pabeni, edumazet, netdev

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 8 Feb 2024 07:59:18 +0100 you wrote:
> Use generic MDIO helpers to simplify the code.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/net/phy/realtek.c | 20 +++-----------------
>  1 file changed, 3 insertions(+), 17 deletions(-)

Here is the summary with links:
  - [net-next] net: phy: realtek: use generic MDIO helpers to simplify the code
    https://git.kernel.org/netdev/net-next/c/b63cc73341e0

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-09 22:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-08  6:59 [PATCH net-next] net: phy: realtek: use generic MDIO helpers to simplify the code Heiner Kallweit
2024-02-08 15:07 ` Andrew Lunn
2024-02-09 22:30 ` patchwork-bot+netdevbpf

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).