aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phylink.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy/phylink.c')
-rw-r--r--drivers/net/phy/phylink.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index e7becc7379d7..938803237d7f 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -474,6 +474,17 @@ static void phylink_run_resolve(struct phylink *pl)
474 queue_work(system_power_efficient_wq, &pl->resolve); 474 queue_work(system_power_efficient_wq, &pl->resolve);
475} 475}
476 476
477static void phylink_run_resolve_and_disable(struct phylink *pl, int bit)
478{
479 unsigned long state = pl->phylink_disable_state;
480
481 set_bit(bit, &pl->phylink_disable_state);
482 if (state == 0) {
483 queue_work(system_power_efficient_wq, &pl->resolve);
484 flush_work(&pl->resolve);
485 }
486}
487
477static void phylink_fixed_poll(struct timer_list *t) 488static void phylink_fixed_poll(struct timer_list *t)
478{ 489{
479 struct phylink *pl = container_of(t, struct phylink, link_poll); 490 struct phylink *pl = container_of(t, struct phylink, link_poll);
@@ -924,9 +935,7 @@ void phylink_stop(struct phylink *pl)
924 if (pl->link_an_mode == MLO_AN_FIXED && !IS_ERR(pl->link_gpio)) 935 if (pl->link_an_mode == MLO_AN_FIXED && !IS_ERR(pl->link_gpio))
925 del_timer_sync(&pl->link_poll); 936 del_timer_sync(&pl->link_poll);
926 937
927 set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state); 938 phylink_run_resolve_and_disable(pl, PHYLINK_DISABLE_STOPPED);
928 queue_work(system_power_efficient_wq, &pl->resolve);
929 flush_work(&pl->resolve);
930} 939}
931EXPORT_SYMBOL_GPL(phylink_stop); 940EXPORT_SYMBOL_GPL(phylink_stop);
932 941
@@ -1632,9 +1641,7 @@ static void phylink_sfp_link_down(void *upstream)
1632 1641
1633 ASSERT_RTNL(); 1642 ASSERT_RTNL();
1634 1643
1635 set_bit(PHYLINK_DISABLE_LINK, &pl->phylink_disable_state); 1644 phylink_run_resolve_and_disable(pl, PHYLINK_DISABLE_LINK);
1636 queue_work(system_power_efficient_wq, &pl->resolve);
1637 flush_work(&pl->resolve);
1638} 1645}
1639 1646
1640static void phylink_sfp_link_up(void *upstream) 1647static void phylink_sfp_link_up(void *upstream)