Skip to content

Commit 352899f

Browse files
kaushlenrafaeljw
authored andcommitted
PM: wakeup: Delete timer before removing wakeup source from list
Replace timer_delete_sync() with timer_shutdown_sync() and move it before list_del_rcu() in wakeup_source_remove() to improve the cleanup ordering and code clarity. This ensures that the timer is stopped before removing the wakeup source from the events list, providing a more logical cleanup sequence. While the current ordering is functionally correct, stopping the timer first makes the cleanup flow more intuitive and follows the general pattern of disabling active components before removing data structures. Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com> [ rjw: Subject and changelog edits ] Link: https://patch.msgid.link/20251027044127.2456365-1-kaushlendra.kumar@intel.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 39ce15a commit 352899f

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

drivers/base/power/wakeup.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,11 @@ static void wakeup_source_remove(struct wakeup_source *ws)
189189
if (WARN_ON(!ws))
190190
return;
191191

192+
timer_shutdown_sync(&ws->timer);
192193
raw_spin_lock_irqsave(&events_lock, flags);
193194
list_del_rcu(&ws->entry);
194195
raw_spin_unlock_irqrestore(&events_lock, flags);
195196
synchronize_srcu(&wakeup_srcu);
196-
197-
timer_delete_sync(&ws->timer);
198-
/*
199-
* Clear timer.function to make wakeup_source_not_registered() treat
200-
* this wakeup source as not registered.
201-
*/
202-
ws->timer.function = NULL;
203197
}
204198

205199
/**

0 commit comments

Comments
 (0)