aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/power')
-rw-r--r--drivers/base/power/wakeup.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 6e591a8a49d..d279f462d62 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -74,22 +74,17 @@ EXPORT_SYMBOL_GPL(wakeup_source_create);
74/** 74/**
75 * wakeup_source_destroy - Destroy a struct wakeup_source object. 75 * wakeup_source_destroy - Destroy a struct wakeup_source object.
76 * @ws: Wakeup source to destroy. 76 * @ws: Wakeup source to destroy.
77 *
78 * Callers must ensure that __pm_stay_awake() or __pm_wakeup_event() will never
79 * be run in parallel with this function for the same wakeup source object.
77 */ 80 */
78void wakeup_source_destroy(struct wakeup_source *ws) 81void wakeup_source_destroy(struct wakeup_source *ws)
79{ 82{
80 if (!ws) 83 if (!ws)
81 return; 84 return;
82 85
83 spin_lock_irq(&ws->lock); 86 del_timer_sync(&ws->timer);
84 while (ws->active) { 87 __pm_relax(ws);
85 spin_unlock_irq(&ws->lock);
86
87 schedule_timeout_interruptible(msecs_to_jiffies(TIMEOUT));
88
89 spin_lock_irq(&ws->lock);
90 }
91 spin_unlock_irq(&ws->lock);
92
93 kfree(ws->name); 88 kfree(ws->name);
94 kfree(ws); 89 kfree(ws);
95} 90}