diff mbox series

[net-next] net: phy: smsc: simplify lan95xx_config_aneg_ext

Message ID 3da785c7-3ef8-b5d3-89a0-340f550be3c2@gmail.com (mailing list archive)
State Accepted
Commit 4310e2f42030ffda0997fb87e2ebdd9711030218
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: phy: smsc: simplify lan95xx_config_aneg_ext | expand

Commit Message

Heiner Kallweit March 6, 2023, 10:10 p.m. UTC
lan95xx_config_aneg_ext() can be simplified by using phy_set_bits().

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

Comments

Simon Horman March 7, 2023, 3:40 p.m. UTC | #1
On Mon, Mar 06, 2023 at 11:10:57PM +0100, Heiner Kallweit wrote:
> lan95xx_config_aneg_ext() can be simplified by using phy_set_bits().
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>
patchwork-bot+netdevbpf@kernel.org March 8, 2023, 8:20 a.m. UTC | #2
Hello:

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

On Mon, 6 Mar 2023 23:10:57 +0100 you wrote:
> lan95xx_config_aneg_ext() can be simplified by using phy_set_bits().
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  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!
diff mbox series

Patch

diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
index be96c474c..0e9fcbe33 100644
--- a/drivers/net/phy/smsc.c
+++ b/drivers/net/phy/smsc.c
@@ -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);
 }