Skip to contentSkip to conversation

net: phy: smsc: simplify lan95xx_config_aneg_ext

PATCH Applied Heiner Kallweit 3 participants 3 messages Mar 6, 2023 – Mar 8, 2023

Subsystems (3)
lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

PATCH 1/1 net: phy: smsc: simplify lan95xx_config_aneg_ext

lan95xx_config_aneg_ext() can be simplified by using phy_set_bits().

---
 drivers/net/phy/smsc.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
drivers/net/phy/smsc.c +7 -10
index be96c474c..0e9fcbe33 100644
@@ -167,18 +167,15 @@ static int lan87xx_config_aneg(struct phy_device *phydev)
 
 static int lan95xx_config_aneg_ext(struct phy_device *phydev)
 {
-	int rc;
-
-	if (phydev->phy_id != 0x0007c0f0) /* not (LAN9500A or LAN9505A) */
-		return lan87xx_config_aneg(phydev);
+	if (phydev->phy_id == 0x0007c0f0) { /* LAN9500A or LAN9505A */
+		/* Extend Manual AutoMDIX timer */
+		int rc = phy_set_bits(phydev, PHY_EDPD_CONFIG,
+				      PHY_EDPD_CONFIG_EXT_CROSSOVER_);
 
-	/* Extend Manual AutoMDIX timer */
-	rc = phy_read(phydev, PHY_EDPD_CONFIG);
-	if (rc < 0)
-		return rc;
+		if (rc < 0)
+			return rc;
+	}
 
-	rc |= PHY_EDPD_CONFIG_EXT_CROSSOVER_;
-	phy_write(phydev, PHY_EDPD_CONFIG, rc);
 	return lan87xx_config_aneg(phydev);
 }
 
Signature · 1 line
2.39.2
#2 lore raw
In reply to Heiner Kallweit
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

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

Quoted 6 lines · On Mon, 6 Mar 2023 23:10:57 +0100 you wrote:

lan95xx_config_aneg_ext() can be simplified by using phy_set_bits().

---
 drivers/net/phy/smsc.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

Here is the summary with links:
- [net-next] net: phy: smsc: simplify lan95xx_config_aneg_ext

    https://git.kernel.org/netdev/net-next/c/4310e2f42030

You are awesome, thank you!

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