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.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 189cd2048c3a..c5675df5fc6f 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -553,7 +553,7 @@ int phy_start_aneg(struct phy_device *phydev)
553 if (err < 0) 553 if (err < 0)
554 goto out_unlock; 554 goto out_unlock;
555 555
556 if (__phy_is_started(phydev)) { 556 if (phy_is_started(phydev)) {
557 if (phydev->autoneg == AUTONEG_ENABLE) { 557 if (phydev->autoneg == AUTONEG_ENABLE) {
558 err = phy_check_link_status(phydev); 558 err = phy_check_link_status(phydev);
559 } else { 559 } else {
@@ -709,7 +709,7 @@ void phy_stop_machine(struct phy_device *phydev)
709 cancel_delayed_work_sync(&phydev->state_queue); 709 cancel_delayed_work_sync(&phydev->state_queue);
710 710
711 mutex_lock(&phydev->lock); 711 mutex_lock(&phydev->lock);
712 if (__phy_is_started(phydev)) 712 if (phy_is_started(phydev))
713 phydev->state = PHY_UP; 713 phydev->state = PHY_UP;
714 mutex_unlock(&phydev->lock); 714 mutex_unlock(&phydev->lock);
715} 715}
@@ -762,9 +762,6 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat)
762{ 762{
763 struct phy_device *phydev = phy_dat; 763 struct phy_device *phydev = phy_dat;
764 764
765 if (!phy_is_started(phydev))
766 return IRQ_NONE; /* It can't be ours. */
767
768 if (phydev->drv->did_interrupt && !phydev->drv->did_interrupt(phydev)) 765 if (phydev->drv->did_interrupt && !phydev->drv->did_interrupt(phydev))
769 return IRQ_NONE; 766 return IRQ_NONE;
770 767
@@ -842,15 +839,14 @@ EXPORT_SYMBOL(phy_stop_interrupts);
842 */ 839 */
843void phy_stop(struct phy_device *phydev) 840void phy_stop(struct phy_device *phydev)
844{ 841{
845 mutex_lock(&phydev->lock); 842 if (!phy_is_started(phydev)) {
846
847 if (!__phy_is_started(phydev)) {
848 WARN(1, "called from state %s\n", 843 WARN(1, "called from state %s\n",
849 phy_state_to_str(phydev->state)); 844 phy_state_to_str(phydev->state));
850 mutex_unlock(&phydev->lock);
851 return; 845 return;
852 } 846 }
853 847
848 mutex_lock(&phydev->lock);
849
854 if (phy_interrupt_is_valid(phydev)) 850 if (phy_interrupt_is_valid(phydev))
855 phy_disable_interrupts(phydev); 851 phy_disable_interrupts(phydev);
856 852
@@ -989,8 +985,10 @@ void phy_state_machine(struct work_struct *work)
989 * state machine would be pointless and possibly error prone when 985 * state machine would be pointless and possibly error prone when
990 * called from phy_disconnect() synchronously. 986 * called from phy_disconnect() synchronously.
991 */ 987 */
988 mutex_lock(&phydev->lock);
992 if (phy_polling_mode(phydev) && phy_is_started(phydev)) 989 if (phy_polling_mode(phydev) && phy_is_started(phydev))
993 phy_queue_state_machine(phydev, PHY_STATE_TIME); 990 phy_queue_state_machine(phydev, PHY_STATE_TIME);
991 mutex_unlock(&phydev->lock);
994} 992}
995 993
996/** 994/**