Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: mc13783_ts - remove deprecated create_singletheread_workqueue

The workqueue "workqueue" has a single workitem(&priv->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.

Workitem is sync cancelled in mc13783_ts_remove() to ensure that there
are no workitems pending when the driver is disconnected.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Bhaktipriya Shridhar and committed by
Dmitry Torokhov
62e51475 24dde60f

+7 -17
+7 -17
drivers/input/touchscreen/mc13783_ts.c
··· 37 37 struct input_dev *idev; 38 38 struct mc13xxx *mc13xxx; 39 39 struct delayed_work work; 40 - struct workqueue_struct *workq; 41 40 unsigned int sample[4]; 42 41 struct mc13xxx_ts_platform_data *touch; 43 42 }; ··· 53 54 * be rescheduled for immediate execution here. However the rearm 54 55 * delay is HZ / 50 which is acceptable. 55 56 */ 56 - queue_delayed_work(priv->workq, &priv->work, 0); 57 + schedule_delayed_work(&priv->work, 0); 57 58 58 59 return IRQ_HANDLED; 59 60 } ··· 105 106 106 107 dev_dbg(&idev->dev, "report (%d, %d, %d)\n", 107 108 x1, y1, 0x1000 - cr0); 108 - queue_delayed_work(priv->workq, &priv->work, HZ / 50); 109 - } else 109 + schedule_delayed_work(&priv->work, HZ / 50); 110 + } else { 110 111 dev_dbg(&idev->dev, "report release\n"); 112 + } 111 113 112 114 input_report_abs(idev, ABS_PRESSURE, 113 115 cr0 ? 0x1000 - cr0 : cr0); 114 116 input_report_key(idev, BTN_TOUCH, cr0); 115 117 input_sync(idev); 116 - } else 118 + } else { 117 119 dev_dbg(&idev->dev, "discard event\n"); 120 + } 118 121 } 119 122 120 123 static void mc13783_ts_work(struct work_struct *work) ··· 190 189 goto err_free_mem; 191 190 } 192 191 193 - /* 194 - * We need separate workqueue because mc13783_adc_do_conversion 195 - * uses keventd and thus would deadlock. 196 - */ 197 - priv->workq = create_singlethread_workqueue("mc13783_ts"); 198 - if (!priv->workq) 199 - goto err_free_mem; 200 - 201 192 idev->name = MC13783_TS_NAME; 202 193 idev->dev.parent = &pdev->dev; 203 194 ··· 208 215 if (ret) { 209 216 dev_err(&pdev->dev, 210 217 "register input device failed with %d\n", ret); 211 - goto err_destroy_wq; 218 + goto err_free_mem; 212 219 } 213 220 214 221 platform_set_drvdata(pdev, priv); 215 222 return 0; 216 223 217 - err_destroy_wq: 218 - destroy_workqueue(priv->workq); 219 224 err_free_mem: 220 225 input_free_device(idev); 221 226 kfree(priv); ··· 224 233 { 225 234 struct mc13783_ts_priv *priv = platform_get_drvdata(pdev); 226 235 227 - destroy_workqueue(priv->workq); 228 236 input_unregister_device(priv->idev); 229 237 kfree(priv); 230 238