Skip to contentSkip to conversation

staging: speakup: Replace del_timer with del_timer_sync

PATCH Superseded Amitoj Kaur Chawla 2 participants 3 messages Mar 5, 2016 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

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>

---
 drivers/staging/speakup/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/main.c +1 -1
index eb8d65a..07b1af4 100644
@@ -2265,7 +2265,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
#1 lore raw
Quoted 2 lines · Amitoj Kaur Chawla

Use del_timer_sync to ensure timer is stopped on all CPUs before the driver exists.

I think that you need to give more information about the need for this. When would the change not be needed, for example?

julia

Quoted 52 lines

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>

---
 drivers/staging/speakup/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/main.c +1 -2
index eb8d65a..07b1af4 100644
@@ -2265,7 +2265,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);
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160305123517.GA11630%40amitoj-Inspiron-3542.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 10 lines · Julia Lawall
Quoted 2 lines · Amitoj Kaur Chawla

Use del_timer_sync to ensure timer is stopped on all CPUs before the driver exists.

I think that you need to give more information about the need for this. When would the change not be needed, for example?

julia

Mention the fact that the timer is not called from a interrupt context so it is safe to switch to del_timer_sync?

Amitoj