[1/3] net: phy: DP83822: Clean up config_init code

Message ID 20220522133813.119729-1-michael@amarulasolutions.com
State New
Headers show
Series
  • [1/3] net: phy: DP83822: Clean up config_init code
Related show

Commit Message

Michael Trimarchi May 22, 2022, 1:38 p.m. UTC
Rename some variables and reduce a bit code complexity. No
functional changes

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/net/phy/dp83822.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

Patch

diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
index ce17b2af3218..c344b8ffaf3c 100644
--- a/drivers/net/phy/dp83822.c
+++ b/drivers/net/phy/dp83822.c
@@ -380,31 +380,26 @@  static int dp83822_config_init(struct phy_device *phydev)
 {
 	struct dp83822_private *dp83822 = phydev->priv;
 	struct device *dev = &phydev->mdio.dev;
-	int rgmii_delay;
-	s32 rx_int_delay;
-	s32 tx_int_delay;
+	int value = 0;
+	s32 trx_int_delay;
 	int err = 0;
 	int bmcr;
 
 	if (phy_interface_is_rgmii(phydev)) {
-		rx_int_delay = phy_get_internal_delay(phydev, dev, NULL, 0,
+		trx_int_delay = phy_get_internal_delay(phydev, dev, NULL, 0,
 						      true);
 
-		if (rx_int_delay <= 0)
-			rgmii_delay = 0;
-		else
-			rgmii_delay = DP83822_RX_CLK_SHIFT;
+		if (trx_int_delay > 0)
+			value = DP83822_RX_CLK_SHIFT;
 
-		tx_int_delay = phy_get_internal_delay(phydev, dev, NULL, 0,
+		trx_int_delay = phy_get_internal_delay(phydev, dev, NULL, 0,
 						      false);
-		if (tx_int_delay <= 0)
-			rgmii_delay &= ~DP83822_TX_CLK_SHIFT;
-		else
-			rgmii_delay |= DP83822_TX_CLK_SHIFT;
+		if (trx_int_delay > 0)
+			value |= DP83822_TX_CLK_SHIFT;
 
-		if (rgmii_delay) {
+		if (value) {
 			err = phy_set_bits_mmd(phydev, DP83822_DEVADDR,
-					       MII_DP83822_RCSR, rgmii_delay);
+					       MII_DP83822_RCSR, value);
 			if (err)
 				return err;
 		}