]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: phy: aquantia: simplify aqr_config_aneg
authorHeiner Kallweit <hkallweit1@gmail.com>
Sat, 23 Mar 2019 13:35:20 +0000 (14:35 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Mar 2019 18:16:22 +0000 (11:16 -0700)
Simplify aqr_config_aneg().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/aquantia_main.c

index f71d4b8e44f7eb56f6eb91b9c04ce313b875c6d1..ef97e1fbc675588798b91550ecfd33395d8c8bed 100644 (file)
@@ -126,41 +126,22 @@ static int aqr_config_aneg(struct phy_device *phydev)
 
 static int aqr_config_intr(struct phy_device *phydev)
 {
+       bool en = phydev->interrupts == PHY_INTERRUPT_ENABLED;
        int err;
 
-       if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
-               err = phy_write_mmd(phydev, MDIO_MMD_AN,
-                                   MDIO_AN_TX_VEND_INT_MASK2,
-                                   MDIO_AN_TX_VEND_INT_MASK2_LINK);
-               if (err < 0)
-                       return err;
-
-               err = phy_write_mmd(phydev, MDIO_MMD_VEND1,
-                                   VEND1_GLOBAL_INT_STD_MASK,
-                                   VEND1_GLOBAL_INT_STD_MASK_ALL);
-               if (err < 0)
-                       return err;
-
-               err = phy_write_mmd(phydev, MDIO_MMD_VEND1,
-                                   VEND1_GLOBAL_INT_VEND_MASK,
-                                   VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 |
-                                   VEND1_GLOBAL_INT_VEND_MASK_AN);
-       } else {
-               err = phy_write_mmd(phydev, MDIO_MMD_AN,
-                                   MDIO_AN_TX_VEND_INT_MASK2, 0);
-               if (err < 0)
-                       return err;
-
-               err = phy_write_mmd(phydev, MDIO_MMD_VEND1,
-                                   VEND1_GLOBAL_INT_STD_MASK, 0);
-               if (err < 0)
-                       return err;
-
-               err = phy_write_mmd(phydev, MDIO_MMD_VEND1,
-                                   VEND1_GLOBAL_INT_VEND_MASK, 0);
-       }
+       err = phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_INT_MASK2,
+                           en ? MDIO_AN_TX_VEND_INT_MASK2_LINK : 0);
+       if (err < 0)
+               return err;
+
+       err = phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_INT_STD_MASK,
+                           en ? VEND1_GLOBAL_INT_STD_MASK_ALL : 0);
+       if (err < 0)
+               return err;
 
-       return err;
+       return phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_INT_VEND_MASK,
+                            en ? VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 |
+                            VEND1_GLOBAL_INT_VEND_MASK_AN : 0);
 }
 
 static int aqr_ack_interrupt(struct phy_device *phydev)