Message ID | E1ihD4V-0001z2-O5@rmk-PC.armlinux.org.uk |
---|---|
State | Accepted |
Delegated to: | David Miller |
Headers | show |
Series | phylib consolidation | expand |
On Tue, Dec 17, 2019 at 01:39:31PM +0000, Russell King wrote: > Rather than using negative logic: > > if (there is no link) > set link = 0 > else > set link = 1 > > use the more natural positive logic: > > if (there is link) > set link = 1 > else > set link = 0 > > Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
On 12/17/19 5:39 AM, Russell King wrote: > Rather than using negative logic: > > if (there is no link) > set link = 0 > else > set link = 1 > > use the more natural positive logic: > > if (there is link) > set link = 1 > else > set link = 0 > > Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index d57df48b3568..4eabb6a26c33 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -168,7 +168,6 @@ #define ADVERTISE_PAUSE_FIBER 0x180 #define ADVERTISE_PAUSE_ASYM_FIBER 0x100 -#define REGISTER_LINK_STATUS 0x400 #define NB_FIBER_STATS 1 MODULE_DESCRIPTION("Marvell PHY driver"); @@ -1203,10 +1202,10 @@ static int marvell_update_link(struct phy_device *phydev, int fiber) if (status < 0) return status; - if ((status & REGISTER_LINK_STATUS) == 0) - phydev->link = 0; - else + if (status & MII_M1011_PHY_STATUS_LINK) phydev->link = 1; + else + phydev->link = 0; } else { return genphy_update_link(phydev); }
Rather than using negative logic: if (there is no link) set link = 0 else set link = 1 use the more natural positive logic: if (there is link) set link = 1 else set link = 0 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> --- drivers/net/phy/marvell.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)