[U-Boot] [PATCH 2/2] phylib: remove a couple of redundant code lines
Andy Fleming
afleming at gmail.com
Thu Sep 22 23:25:02 CEST 2011
On Mon, Sep 5, 2011 at 12:24 PM, Vladimir Zapolskiy <vz at mleia.com> wrote:
> This change slightly improves readability of the phydev speed/duplex
> assignment logic.
Shoot, I just saw this patch in my tree. It's incorrect.
> @@ -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;
The lines weren't redundant. The logic is (and probably should be
better commented):
Find the intersection of the advertised capabilities of both sides of
the link (lpa)
More information about the U-Boot
mailing list