OSDN Git Service

net: phy: add phy_check_link_status
authorHeiner Kallweit <hkallweit1@gmail.com>
Wed, 7 Nov 2018 19:45:58 +0000 (20:45 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 8 Nov 2018 23:02:05 +0000 (15:02 -0800)
commit74a992b3598ad22784ce238f59875b782e1ca537
treef09d120b0ad5e0aba5937250acd82e4583940d19
parentc96469f830568d8859cd65d723da3b79ec0219e0
net: phy: add phy_check_link_status

In few places in the state machine the state is set to PHY_RUNNING or
PHY_NOLINK after doing a phy_read_status(). So factor this out to
phy_check_link_status().

First use it in phy_start_aneg(): By setting the state to PHY_RUNNING
or PHY_NOLINK directly we can remove the code to handle the case that
we're using interrupts and aneg was finished already.

Definition of phy_link_up and phy_link_down needs to be moved because
they are called in the new function.

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