aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/power/wakeup.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 8a0a9ca6ad65..e6ee5e80e546 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -127,6 +127,8 @@ EXPORT_SYMBOL_GPL(wakeup_source_destroy);
127 */ 127 */
128void wakeup_source_add(struct wakeup_source *ws) 128void wakeup_source_add(struct wakeup_source *ws)
129{ 129{
130 unsigned long flags;
131
130 if (WARN_ON(!ws)) 132 if (WARN_ON(!ws))
131 return; 133 return;
132 134
@@ -135,9 +137,9 @@ void wakeup_source_add(struct wakeup_source *ws)
135 ws->active = false; 137 ws->active = false;
136 ws->last_time = ktime_get(); 138 ws->last_time = ktime_get();
137 139
138 spin_lock_irq(&events_lock); 140 spin_lock_irqsave(&events_lock, flags);
139 list_add_rcu(&ws->entry, &wakeup_sources); 141 list_add_rcu(&ws->entry, &wakeup_sources);
140 spin_unlock_irq(&events_lock); 142 spin_unlock_irqrestore(&events_lock, flags);
141} 143}
142EXPORT_SYMBOL_GPL(wakeup_source_add); 144EXPORT_SYMBOL_GPL(wakeup_source_add);
143 145
@@ -147,12 +149,14 @@ EXPORT_SYMBOL_GPL(wakeup_source_add);
147 */ 149 */
148void wakeup_source_remove(struct wakeup_source *ws) 150void wakeup_source_remove(struct wakeup_source *ws)
149{ 151{
152 unsigned long flags;
153
150 if (WARN_ON(!ws)) 154 if (WARN_ON(!ws))
151 return; 155 return;
152 156
153 spin_lock_irq(&events_lock); 157 spin_lock_irqsave(&events_lock, flags);
154 list_del_rcu(&ws->entry); 158 list_del_rcu(&ws->entry);
155 spin_unlock_irq(&events_lock); 159 spin_unlock_irqrestore(&events_lock, flags);
156 synchronize_rcu(); 160 synchronize_rcu();
157} 161}
158EXPORT_SYMBOL_GPL(wakeup_source_remove); 162EXPORT_SYMBOL_GPL(wakeup_source_remove);
@@ -752,15 +756,16 @@ bool pm_get_wakeup_count(unsigned int *count, bool block)
752bool pm_save_wakeup_count(unsigned int count) 756bool pm_save_wakeup_count(unsigned int count)
753{ 757{
754 unsigned int cnt, inpr; 758 unsigned int cnt, inpr;
759 unsigned long flags;
755 760
756 events_check_enabled = false; 761 events_check_enabled = false;
757 spin_lock_irq(&events_lock); 762 spin_lock_irqsave(&events_lock, flags);
758 split_counters(&cnt, &inpr); 763 split_counters(&cnt, &inpr);
759 if (cnt == count && inpr == 0) { 764 if (cnt == count && inpr == 0) {
760 saved_count = count; 765 saved_count = count;
761 events_check_enabled = true; 766 events_check_enabled = true;
762 } 767 }
763 spin_unlock_irq(&events_lock); 768 spin_unlock_irqrestore(&events_lock, flags);
764 return events_check_enabled; 769 return events_check_enabled;
765} 770}
766 771