Skip to content

Commit a17ceec

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: phylink: add phylink_link_is_up() helper
Add a helper to determine whether the link is up or down. Currently this is only used in one location, but becomes necessary to test when reconfiguring EEE. Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a00e0d3 commit a17ceec

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/net/phy/phylink.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,20 +1651,21 @@ static void phylink_link_down(struct phylink *pl)
16511651
phylink_info(pl, "Link is Down\n");
16521652
}
16531653

1654+
static bool phylink_link_is_up(struct phylink *pl)
1655+
{
1656+
return pl->netdev ? netif_carrier_ok(pl->netdev) : pl->old_link_state;
1657+
}
1658+
16541659
static void phylink_resolve(struct work_struct *w)
16551660
{
16561661
struct phylink *pl = container_of(w, struct phylink, resolve);
16571662
struct phylink_link_state link_state;
1658-
struct net_device *ndev = pl->netdev;
16591663
bool mac_config = false;
16601664
bool retrigger = false;
16611665
bool cur_link_state;
16621666

16631667
mutex_lock(&pl->state_mutex);
1664-
if (pl->netdev)
1665-
cur_link_state = netif_carrier_ok(ndev);
1666-
else
1667-
cur_link_state = pl->old_link_state;
1668+
cur_link_state = phylink_link_is_up(pl);
16681669

16691670
if (pl->phylink_disable_state) {
16701671
pl->link_failed = false;

0 commit comments

Comments
 (0)