Skip to contentSkip to conversation

Input: synaptics-rmi4 - add missed operations in remove

PATCH Superseded Chuhong Yuan 2 participants 4 messages Nov 13, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: synaptics-rmi4 - add missed operations in remove

The driver forgets to deal with work and workqueue in remove like what is done when probe fails.
Add the missed operations to fix it.

---
 drivers/input/rmi4/rmi_f54.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/input/rmi4/rmi_f54.c +3 -0
index 710b02595486..2c0cde5c775c 100644
@@ -730,6 +730,9 @@ static void rmi_f54_remove(struct rmi_function *fn)
 
 	video_unregister_device(&f54->vdev);
 	v4l2_device_unregister(&f54->v4l2);
+	cancel_delayed_work_sync(&f54->work);
+	flush_workqueue(f54->workqueue);
+	destroy_workqueue(f54->workqueue);
 }
 
 struct rmi_function_handler rmi_f54_handler = {
Signature · 1 line
2.23.0
maintainer
#1 lore raw
Quoted 3 lines · Chuhong Yuan

The driver forgets to deal with work and workqueue in remove like what is done when probe fails.
Add the missed operations to fix it.

Is it really possible for the work to still be pending when fully registered device is properly unregistered? I thought we'd wait for successful data acquisition in rmi_f54_buffer_queue() before unregister can complete.

Quoted 23 lines
---
 drivers/input/rmi4/rmi_f54.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/input/rmi4/rmi_f54.c +3 -0
index 710b02595486..2c0cde5c775c 100644
@@ -730,6 +730,9 @@ static void rmi_f54_remove(struct rmi_function *fn)
 
 	video_unregister_device(&f54->vdev);
 	v4l2_device_unregister(&f54->v4l2);
+	cancel_delayed_work_sync(&f54->work);
+	flush_workqueue(f54->workqueue);
+	destroy_workqueue(f54->workqueue);
 }
 
 struct rmi_function_handler rmi_f54_handler = {
Signature · 1 line
2.23.0

Thanks.

Signature · 1 line
Dmitry
#2 lore raw
Quoted 11 lines · Dmitry Torokhov
Quoted 3 lines · Chuhong Yuan

The driver forgets to deal with work and workqueue in remove like what is done when probe fails.
Add the missed operations to fix it.

Is it really possible for the work to still be pending when fully registered device is properly unregistered? I thought we'd wait for successful data acquisition in rmi_f54_buffer_queue() before unregister can complete.

In fact, I am not familiar with the mechanism here...
I have checked other drivers with video_unregister_device and found none of them deals with work in remove.
Therefore, I think your opinion should be right and we only need to deal with the workqueue.

Regards,
Chuhong

Quoted 28 lines
Quoted 21 lines
---
 drivers/input/rmi4/rmi_f54.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/input/rmi4/rmi_f54.c +3 -1
index 710b02595486..2c0cde5c775c 100644
@@ -730,6 +730,9 @@ static void rmi_f54_remove(struct rmi_function *fn)
 
      video_unregister_device(&f54->vdev);
      v4l2_device_unregister(&f54->v4l2);
+     cancel_delayed_work_sync(&f54->work);
+     flush_workqueue(f54->workqueue);
+     destroy_workqueue(f54->workqueue);
 }
 
 struct rmi_function_handler rmi_f54_handler = {
--
Quoted 2 lines

2.23.0

Thanks.

--
Dmitry

maintainer
#3 lore raw
Quoted 14 lines · Chuhong Yuan
Quoted 11 lines · Dmitry Torokhov
Quoted 3 lines · Chuhong Yuan

The driver forgets to deal with work and workqueue in remove like what is done when probe fails.
Add the missed operations to fix it.

Is it really possible for the work to still be pending when fully registered device is properly unregistered? I thought we'd wait for successful data acquisition in rmi_f54_buffer_queue() before unregister can complete.

Quoted 5 lines

In fact, I am not familiar with the mechanism here...
I have checked other drivers with video_unregister_device and found none of them deals with work in remove.
Therefore, I think your opinion should be right and we only need to deal with the workqueue.

OK, please send the updated patch then.

Thanks!

Signature · 1 line
Dmitry