aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBhaktipriya Shridhar <bhaktipriya96@gmail.com>2016-07-09 03:52:29 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-07-09 06:43:53 -0400
commitf7cf0362f6ad13e1235a731456641178a4280c90 (patch)
treebfec4efc155c746eb761da8d409162dddee4bdf2
parente0f80d8d62f50d7df0ce7eacd1246fcafd1e40be (diff)
[media] zc3xx: Remove deprecated create_singlethread_workqueue
The workqueue "work_thread" is involved in updating parameters for transfers. It has a single work item(&sd->work) and hence doesn't require ordering. Also, it is not being used on a memory reclaim path. Hence, the singlethreaded workqueue has been replaced with the use of system_wq. System workqueues have been able to handle high level of concurrency for a long time now and hence it's not required to have a singlethreaded workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue created with create_singlethread_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantee unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. Work item has been flushed in sd_stop0() to ensure that there are no pending tasks while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/usb/gspca/zc3xx.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/media/usb/gspca/zc3xx.c b/drivers/media/usb/gspca/zc3xx.c
index c5d8ee6fa3c7..5f7254d2bc9a 100644
--- a/drivers/media/usb/gspca/zc3xx.c
+++ b/drivers/media/usb/gspca/zc3xx.c
@@ -53,7 +53,6 @@ struct sd {
53 struct v4l2_ctrl *jpegqual; 53 struct v4l2_ctrl *jpegqual;
54 54
55 struct work_struct work; 55 struct work_struct work;
56 struct workqueue_struct *work_thread;
57 56
58 u8 reg08; /* webcam compression quality */ 57 u8 reg08; /* webcam compression quality */
59 58
@@ -6826,8 +6825,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
6826 return gspca_dev->usb_err; 6825 return gspca_dev->usb_err;
6827 6826
6828 /* Start the transfer parameters update thread */ 6827 /* Start the transfer parameters update thread */
6829 sd->work_thread = create_singlethread_workqueue(KBUILD_MODNAME); 6828 schedule_work(&sd->work);
6830 queue_work(sd->work_thread, &sd->work);
6831 6829
6832 return 0; 6830 return 0;
6833} 6831}
@@ -6838,12 +6836,9 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
6838{ 6836{
6839 struct sd *sd = (struct sd *) gspca_dev; 6837 struct sd *sd = (struct sd *) gspca_dev;
6840 6838
6841 if (sd->work_thread != NULL) { 6839 mutex_unlock(&gspca_dev->usb_lock);
6842 mutex_unlock(&gspca_dev->usb_lock); 6840 flush_work(&sd->work);
6843 destroy_workqueue(sd->work_thread); 6841 mutex_lock(&gspca_dev->usb_lock);
6844 mutex_lock(&gspca_dev->usb_lock);
6845 sd->work_thread = NULL;
6846 }
6847 if (!gspca_dev->present) 6842 if (!gspca_dev->present)
6848 return; 6843 return;
6849 send_unknown(gspca_dev, sd->sensor); 6844 send_unknown(gspca_dev, sd->sensor);