Skip to contentSkip to conversation

staging: speakup: Replace del_timer with del_timer_sync

PATCH New Amitoj Kaur Chawla 1 participant 1 message Mar 6, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: speakup: Replace del_timer with del_timer_sync

Use del_timer_sync to ensure timer is stopped on all CPUs before the driver exists and the timer should not run when the module is being removed. Since the timer is not called from an interrupt context, this change is safe and will not cause deadlock.

The Coccinelle semantic patch used to make this change is as follows:
// <smpl>
@r@
declarer name module_exit;
identifier ex;
@@

module_exit(ex);

@@
identifier r.ex;
@@

ex(...) {
<...
- del_timer
+ del_timer_sync

    (...)

...>
}
// </smpl>

---
Changes in v2:
-Modified commit message

 drivers/staging/speakup/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/main.c +1 -1
index a87224c..a22fb07 100644
@@ -2274,7 +2274,7 @@ static void __exit speakup_exit(void)
 	unregister_vt_notifier(&vt_notifier_block);
 	speakup_unregister_devsynth();
 	speakup_cancel_paste();
-	del_timer(&cursor_timer);
+	del_timer_sync(&cursor_timer);
 	kthread_stop(speakup_task);
 	speakup_task = NULL;
 	mutex_lock(&spk_mutex);
Signature · 1 line
1.9.1