aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 48da6e93c3f7..7cc1b7dcfe05 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -29,6 +29,7 @@
29#include <linux/mii.h> 29#include <linux/mii.h>
30#include <linux/ethtool.h> 30#include <linux/ethtool.h>
31#include <linux/phy.h> 31#include <linux/phy.h>
32#include <linux/phy_led_triggers.h>
32#include <linux/timer.h> 33#include <linux/timer.h>
33#include <linux/workqueue.h> 34#include <linux/workqueue.h>
34#include <linux/mdio.h> 35#include <linux/mdio.h>
@@ -649,14 +650,18 @@ void phy_start_machine(struct phy_device *phydev)
649 * phy_trigger_machine - trigger the state machine to run 650 * phy_trigger_machine - trigger the state machine to run
650 * 651 *
651 * @phydev: the phy_device struct 652 * @phydev: the phy_device struct
653 * @sync: indicate whether we should wait for the workqueue cancelation
652 * 654 *
653 * Description: There has been a change in state which requires that the 655 * Description: There has been a change in state which requires that the
654 * state machine runs. 656 * state machine runs.
655 */ 657 */
656 658
657static void phy_trigger_machine(struct phy_device *phydev) 659static void phy_trigger_machine(struct phy_device *phydev, bool sync)
658{ 660{
659 cancel_delayed_work_sync(&phydev->state_queue); 661 if (sync)
662 cancel_delayed_work_sync(&phydev->state_queue);
663 else
664 cancel_delayed_work(&phydev->state_queue);
660 queue_delayed_work(system_power_efficient_wq, &phydev->state_queue, 0); 665 queue_delayed_work(system_power_efficient_wq, &phydev->state_queue, 0);
661} 666}
662 667
@@ -693,7 +698,7 @@ static void phy_error(struct phy_device *phydev)
693 phydev->state = PHY_HALTED; 698 phydev->state = PHY_HALTED;
694 mutex_unlock(&phydev->lock); 699 mutex_unlock(&phydev->lock);
695 700
696 phy_trigger_machine(phydev); 701 phy_trigger_machine(phydev, false);
697} 702}
698 703
699/** 704/**
@@ -840,7 +845,7 @@ void phy_change(struct phy_device *phydev)
840 } 845 }
841 846
842 /* reschedule state queue work to run as soon as possible */ 847 /* reschedule state queue work to run as soon as possible */
843 phy_trigger_machine(phydev); 848 phy_trigger_machine(phydev, true);
844 return; 849 return;
845 850
846ignore: 851ignore:
@@ -942,7 +947,7 @@ void phy_start(struct phy_device *phydev)
942 if (do_resume) 947 if (do_resume)
943 phy_resume(phydev); 948 phy_resume(phydev);
944 949
945 phy_trigger_machine(phydev); 950 phy_trigger_machine(phydev, true);
946} 951}
947EXPORT_SYMBOL(phy_start); 952EXPORT_SYMBOL(phy_start);
948 953