@@ -537,7 +537,7 @@ static int phy_start_aneg_priv(struct phy_device *phydev, bool sync)
537
537
mutex_unlock (& phydev -> lock );
538
538
539
539
if (trigger )
540
- phy_trigger_machine (phydev , sync );
540
+ phy_trigger_machine (phydev );
541
541
542
542
return err ;
543
543
}
@@ -635,6 +635,13 @@ int phy_speed_up(struct phy_device *phydev)
635
635
}
636
636
EXPORT_SYMBOL_GPL (phy_speed_up );
637
637
638
+ static void phy_queue_state_machine (struct phy_device * phydev ,
639
+ unsigned int secs )
640
+ {
641
+ mod_delayed_work (system_power_efficient_wq , & phydev -> state_queue ,
642
+ secs * HZ );
643
+ }
644
+
638
645
/**
639
646
* phy_start_machine - start PHY state machine tracking
640
647
* @phydev: the phy_device struct
@@ -647,27 +654,22 @@ EXPORT_SYMBOL_GPL(phy_speed_up);
647
654
*/
648
655
void phy_start_machine (struct phy_device * phydev )
649
656
{
650
- queue_delayed_work ( system_power_efficient_wq , & phydev -> state_queue , HZ );
657
+ phy_queue_state_machine ( phydev , 1 );
651
658
}
652
659
EXPORT_SYMBOL_GPL (phy_start_machine );
653
660
654
661
/**
655
662
* phy_trigger_machine - trigger the state machine to run
656
663
*
657
664
* @phydev: the phy_device struct
658
- * @sync: indicate whether we should wait for the workqueue cancelation
659
665
*
660
666
* Description: There has been a change in state which requires that the
661
667
* state machine runs.
662
668
*/
663
669
664
- void phy_trigger_machine (struct phy_device * phydev , bool sync )
670
+ void phy_trigger_machine (struct phy_device * phydev )
665
671
{
666
- if (sync )
667
- cancel_delayed_work_sync (& phydev -> state_queue );
668
- else
669
- cancel_delayed_work (& phydev -> state_queue );
670
- queue_delayed_work (system_power_efficient_wq , & phydev -> state_queue , 0 );
672
+ phy_queue_state_machine (phydev , 0 );
671
673
}
672
674
673
675
/**
@@ -703,7 +705,7 @@ static void phy_error(struct phy_device *phydev)
703
705
phydev -> state = PHY_HALTED ;
704
706
mutex_unlock (& phydev -> lock );
705
707
706
- phy_trigger_machine (phydev , false );
708
+ phy_trigger_machine (phydev );
707
709
}
708
710
709
711
/**
@@ -745,7 +747,7 @@ static irqreturn_t phy_change(struct phy_device *phydev)
745
747
mutex_unlock (& phydev -> lock );
746
748
747
749
/* reschedule state queue work to run as soon as possible */
748
- phy_trigger_machine (phydev , true );
750
+ phy_trigger_machine (phydev );
749
751
750
752
if (phy_interrupt_is_valid (phydev ) && phy_clear_interrupt (phydev ))
751
753
goto phy_err ;
@@ -911,7 +913,7 @@ void phy_start(struct phy_device *phydev)
911
913
}
912
914
mutex_unlock (& phydev -> lock );
913
915
914
- phy_trigger_machine (phydev , true );
916
+ phy_trigger_machine (phydev );
915
917
}
916
918
EXPORT_SYMBOL (phy_start );
917
919
@@ -1130,8 +1132,7 @@ void phy_state_machine(struct work_struct *work)
1130
1132
* called from phy_disconnect() synchronously.
1131
1133
*/
1132
1134
if (phy_polling_mode (phydev ) && old_state != PHY_HALTED )
1133
- queue_delayed_work (system_power_efficient_wq , & phydev -> state_queue ,
1134
- PHY_STATE_TIME * HZ );
1135
+ phy_queue_state_machine (phydev , PHY_STATE_TIME );
1135
1136
}
1136
1137
1137
1138
/**
0 commit comments