Commit 43aa56d9 authored by Bhaktipriya Shridhar's avatar Bhaktipriya Shridhar Committed by Takashi Iwai

ALSA: sh: aica: Remove deprecated create_workqueue

System workqueues have been able to handle high level of concurrency
for a long time now and there's no reason to use dedicated workqueues
just to gain concurrency. Since aica_queue for AICA sound
driver has workitem dreamcastcard->spu_dma_work (maps to run_spu_dma)
which is involved in aica dma transfers and is not being used on a memory
reclaim path, dedicated aica_queue has been replaced with the
use of system_wq.

Unlike a dedicated per-cpu workqueue created with create_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 guarantees unless the target CPU is
explicitly specified and thus the increase of local concurrency
shouldn't make any difference.

Since the work items could be pending, flush_work() has been used in
snd_aicapcm_pcm_close() to ensure that there is no pending task while
disconnecting the driver.
Signed-off-by: default avatarBhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent fabc16fe
...@@ -63,9 +63,6 @@ MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard."); ...@@ -63,9 +63,6 @@ MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard.");
module_param(enable, bool, 0644); module_param(enable, bool, 0644);
MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard."); MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard.");
/* Use workqueue */
static struct workqueue_struct *aica_queue;
/* Simple platform device */ /* Simple platform device */
static struct platform_device *pd; static struct platform_device *pd;
static struct resource aica_memory_space[2] = { static struct resource aica_memory_space[2] = {
...@@ -327,7 +324,7 @@ static void aica_period_elapsed(unsigned long timer_var) ...@@ -327,7 +324,7 @@ static void aica_period_elapsed(unsigned long timer_var)
dreamcastcard->current_period = play_period; dreamcastcard->current_period = play_period;
if (unlikely(dreamcastcard->dma_check == 0)) if (unlikely(dreamcastcard->dma_check == 0))
dreamcastcard->dma_check = 1; dreamcastcard->dma_check = 1;
queue_work(aica_queue, &(dreamcastcard->spu_dma_work)); schedule_work(&(dreamcastcard->spu_dma_work));
} }
static void spu_begin_dma(struct snd_pcm_substream *substream) static void spu_begin_dma(struct snd_pcm_substream *substream)
...@@ -337,7 +334,7 @@ static void spu_begin_dma(struct snd_pcm_substream *substream) ...@@ -337,7 +334,7 @@ static void spu_begin_dma(struct snd_pcm_substream *substream)
runtime = substream->runtime; runtime = substream->runtime;
dreamcastcard = substream->pcm->private_data; dreamcastcard = substream->pcm->private_data;
/*get the queue to do the work */ /*get the queue to do the work */
queue_work(aica_queue, &(dreamcastcard->spu_dma_work)); schedule_work(&(dreamcastcard->spu_dma_work));
/* Timer may already be running */ /* Timer may already be running */
if (unlikely(dreamcastcard->timer.data)) { if (unlikely(dreamcastcard->timer.data)) {
mod_timer(&dreamcastcard->timer, jiffies + 4); mod_timer(&dreamcastcard->timer, jiffies + 4);
...@@ -381,7 +378,7 @@ static int snd_aicapcm_pcm_close(struct snd_pcm_substream ...@@ -381,7 +378,7 @@ static int snd_aicapcm_pcm_close(struct snd_pcm_substream
*substream) *substream)
{ {
struct snd_card_aica *dreamcastcard = substream->pcm->private_data; struct snd_card_aica *dreamcastcard = substream->pcm->private_data;
flush_workqueue(aica_queue); flush_work(&(dreamcastcard->spu_dma_work));
if (dreamcastcard->timer.data) if (dreamcastcard->timer.data)
del_timer(&dreamcastcard->timer); del_timer(&dreamcastcard->timer);
kfree(dreamcastcard->channel); kfree(dreamcastcard->channel);
...@@ -633,9 +630,6 @@ static int snd_aica_probe(struct platform_device *devptr) ...@@ -633,9 +630,6 @@ static int snd_aica_probe(struct platform_device *devptr)
if (unlikely(err < 0)) if (unlikely(err < 0))
goto freedreamcast; goto freedreamcast;
platform_set_drvdata(devptr, dreamcastcard); platform_set_drvdata(devptr, dreamcastcard);
aica_queue = create_workqueue(CARD_NAME);
if (unlikely(!aica_queue))
goto freedreamcast;
snd_printk snd_printk
("ALSA Driver for Yamaha AICA Super Intelligent Sound Processor\n"); ("ALSA Driver for Yamaha AICA Super Intelligent Sound Processor\n");
return 0; return 0;
...@@ -671,10 +665,6 @@ static int __init aica_init(void) ...@@ -671,10 +665,6 @@ static int __init aica_init(void)
static void __exit aica_exit(void) static void __exit aica_exit(void)
{ {
/* Destroy the aica kernel thread *
* being extra cautious to check if it exists*/
if (likely(aica_queue))
destroy_workqueue(aica_queue);
platform_device_unregister(pd); platform_device_unregister(pd);
platform_driver_unregister(&snd_aica_driver); platform_driver_unregister(&snd_aica_driver);
/* Kill any sound still playing and reset ARM7 to safe state */ /* Kill any sound still playing and reset ARM7 to safe state */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment