@@ -24,6 +24,9 @@ suspend_state_t pm_suspend_target_state;
24
24
#define pm_suspend_target_state (PM_SUSPEND_ON)
25
25
#endif
26
26
27
+ #define list_for_each_entry_rcu_locked (pos , head , member ) \
28
+ list_for_each_entry_rcu(pos, head, member, \
29
+ srcu_read_lock_held(&wakeup_srcu))
27
30
/*
28
31
* If set, the suspend/hibernate code will abort transitions to a sleep state
29
32
* if wakeup events are registered during or immediately before the transition.
@@ -405,7 +408,7 @@ void device_wakeup_arm_wake_irqs(void)
405
408
int srcuidx ;
406
409
407
410
srcuidx = srcu_read_lock (& wakeup_srcu );
408
- list_for_each_entry_rcu (ws , & wakeup_sources , entry )
411
+ list_for_each_entry_rcu_locked (ws , & wakeup_sources , entry )
409
412
dev_pm_arm_wake_irq (ws -> wakeirq );
410
413
srcu_read_unlock (& wakeup_srcu , srcuidx );
411
414
}
@@ -421,7 +424,7 @@ void device_wakeup_disarm_wake_irqs(void)
421
424
int srcuidx ;
422
425
423
426
srcuidx = srcu_read_lock (& wakeup_srcu );
424
- list_for_each_entry_rcu (ws , & wakeup_sources , entry )
427
+ list_for_each_entry_rcu_locked (ws , & wakeup_sources , entry )
425
428
dev_pm_disarm_wake_irq (ws -> wakeirq );
426
429
srcu_read_unlock (& wakeup_srcu , srcuidx );
427
430
}
@@ -874,7 +877,7 @@ void pm_print_active_wakeup_sources(void)
874
877
struct wakeup_source * last_activity_ws = NULL ;
875
878
876
879
srcuidx = srcu_read_lock (& wakeup_srcu );
877
- list_for_each_entry_rcu (ws , & wakeup_sources , entry ) {
880
+ list_for_each_entry_rcu_locked (ws , & wakeup_sources , entry ) {
878
881
if (ws -> active ) {
879
882
pm_pr_dbg ("active wakeup source: %s\n" , ws -> name );
880
883
active = 1 ;
@@ -1025,7 +1028,7 @@ void pm_wakep_autosleep_enabled(bool set)
1025
1028
int srcuidx ;
1026
1029
1027
1030
srcuidx = srcu_read_lock (& wakeup_srcu );
1028
- list_for_each_entry_rcu (ws , & wakeup_sources , entry ) {
1031
+ list_for_each_entry_rcu_locked (ws , & wakeup_sources , entry ) {
1029
1032
spin_lock_irq (& ws -> lock );
1030
1033
if (ws -> autosleep_enabled != set ) {
1031
1034
ws -> autosleep_enabled = set ;
@@ -1104,7 +1107,7 @@ static void *wakeup_sources_stats_seq_start(struct seq_file *m,
1104
1107
}
1105
1108
1106
1109
* srcuidx = srcu_read_lock (& wakeup_srcu );
1107
- list_for_each_entry_rcu (ws , & wakeup_sources , entry ) {
1110
+ list_for_each_entry_rcu_locked (ws , & wakeup_sources , entry ) {
1108
1111
if (n -- <= 0 )
1109
1112
return ws ;
1110
1113
}
0 commit comments