phylib: remove a couple of redundant code lines
authorVladimir Zapolskiy <vz@mleia.com>
Mon, 5 Sep 2011 07:24:08 +0000 (07:24 +0000)
committerWolfgang Denk <wd@denx.de>
Fri, 9 Sep 2011 22:08:26 +0000 (00:08 +0200)
This change slightly improves readability of the phydev speed/duplex
assignment logic.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Acked-by: Detlev Zundel <dzu@denx.de>
drivers/net/phy/phy.c

index 8da7688..833a051 100644 (file)
@@ -318,13 +318,10 @@ static int genphy_parse_link(struct phy_device *phydev)
                lpa = phy_read(phydev, MDIO_DEVAD_NONE, MII_ADVERTISE);
                lpa &= phy_read(phydev, MDIO_DEVAD_NONE, MII_LPA);
 
-               if (lpa & (LPA_100FULL | LPA_100HALF)) {
+               if (lpa & (LPA_100FULL | LPA_100HALF))
                        phydev->speed = SPEED_100;
 
-                       if (lpa & LPA_100FULL)
-                               phydev->duplex = DUPLEX_FULL;
-
-               } else if (lpa & LPA_10FULL)
+               if (lpa & (LPA_100FULL | LPA_10FULL))
                        phydev->duplex = DUPLEX_FULL;
        } else {
                u32 bmcr = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);