@@ -524,8 +524,11 @@ void etr_switch_to_local(void)
524
524
if (!etr_eacr .sl )
525
525
return ;
526
526
disable_sync_clock (NULL );
527
- set_bit (ETR_EVENT_SWITCH_LOCAL , & etr_events );
528
- queue_work (time_sync_wq , & etr_work );
527
+ if (!test_and_set_bit (ETR_EVENT_SWITCH_LOCAL , & etr_events )) {
528
+ etr_eacr .es = etr_eacr .sl = 0 ;
529
+ etr_setr (& etr_eacr );
530
+ queue_work (time_sync_wq , & etr_work );
531
+ }
529
532
}
530
533
531
534
/*
@@ -539,8 +542,11 @@ void etr_sync_check(void)
539
542
if (!etr_eacr .es )
540
543
return ;
541
544
disable_sync_clock (NULL );
542
- set_bit (ETR_EVENT_SYNC_CHECK , & etr_events );
543
- queue_work (time_sync_wq , & etr_work );
545
+ if (!test_and_set_bit (ETR_EVENT_SYNC_CHECK , & etr_events )) {
546
+ etr_eacr .es = 0 ;
547
+ etr_setr (& etr_eacr );
548
+ queue_work (time_sync_wq , & etr_work );
549
+ }
544
550
}
545
551
546
552
/*
@@ -902,7 +908,7 @@ static struct etr_eacr etr_handle_update(struct etr_aib *aib,
902
908
* Do not try to get the alternate port aib if the clock
903
909
* is not in sync yet.
904
910
*/
905
- if (!check_sync_clock ())
911
+ if (!eacr . es || ! check_sync_clock ())
906
912
return eacr ;
907
913
908
914
/*
@@ -1064,7 +1070,7 @@ static void etr_work_fn(struct work_struct *work)
1064
1070
* If the clock is in sync just update the eacr and return.
1065
1071
* If there is no valid sync port wait for a port update.
1066
1072
*/
1067
- if (check_sync_clock () || sync_port < 0 ) {
1073
+ if (( eacr . es && check_sync_clock () ) || sync_port < 0 ) {
1068
1074
etr_update_eacr (eacr );
1069
1075
etr_set_tolec_timeout (now );
1070
1076
goto out_unlock ;
0 commit comments