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

[media] cx25821: Remove deprecated create_singlethread_workqueue

The workqueue "_irq_audio_queues" runs the audio upstream handler.
It has a single work item(&dev->_audio_work_entry) 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.

The work item has been flushed in cx25821_stop_upstream_audio() to ensure
that nothing is pending when the driver is disconnected.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Bhaktipriya Shridhar and committed by
Mauro Carvalho Chehab
072973ba 534e1f3c

+2 -13
+2 -12
drivers/media/pci/cx25821/cx25821-audio-upstream.c
··· 242 242 dev->_audioframe_count = 0; 243 243 dev->_audiofile_status = END_OF_FILE; 244 244 245 - destroy_workqueue(dev->_irq_audio_queues); 246 - dev->_irq_audio_queues = NULL; 245 + flush_work(&dev->_audio_work_entry); 247 246 248 247 kfree(dev->_audiofilename); 249 248 } ··· 445 446 446 447 dev->_audioframe_index = dev->_last_index_irq; 447 448 448 - queue_work(dev->_irq_audio_queues, 449 - &dev->_audio_work_entry); 449 + schedule_work(&dev->_audio_work_entry); 450 450 } 451 451 452 452 if (dev->_is_first_audio_frame) { ··· 637 639 638 640 /* Work queue */ 639 641 INIT_WORK(&dev->_audio_work_entry, cx25821_audioups_handler); 640 - dev->_irq_audio_queues = 641 - create_singlethread_workqueue("cx25821_audioworkqueue"); 642 - 643 - if (!dev->_irq_audio_queues) { 644 - printk(KERN_DEBUG 645 - pr_fmt("ERROR: create_singlethread_workqueue() for Audio FAILED!\n")); 646 - return -ENOMEM; 647 - } 648 642 649 643 dev->_last_index_irq = 0; 650 644 dev->_audio_is_running = 0;
-1
drivers/media/pci/cx25821/cx25821.h
··· 293 293 u32 audio_upstream_riscbuf_size; 294 294 u32 audio_upstream_databuf_size; 295 295 int _audioframe_index; 296 - struct workqueue_struct *_irq_audio_queues; 297 296 struct work_struct _audio_work_entry; 298 297 char *input_audiofilename; 299 298