diff options
author | Subhransu S. Prusty <subhransu.s.prusty@intel.com> | 2014-10-30 16:21:45 +0530 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-10-31 16:57:25 +0000 |
commit | 7e73e4d80539d0392010dfac3116307e7c9cf33d (patch) | |
tree | 1b37e7303f56f26dd7f05bf98abf0212ed24412b /sound/soc/intel/sst/sst.c | |
parent | 3172fcddcea230f129e8916628672617ef3c836c (diff) | |
download | op-kernel-dev-7e73e4d80539d0392010dfac3116307e7c9cf33d.zip op-kernel-dev-7e73e4d80539d0392010dfac3116307e7c9cf33d.tar.gz |
ASoC: Intel: move the driver wq init to a routine
This will be used by ACPI code as well, so moving to common routine helps
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/sst/sst.c')
-rw-r--r-- | sound/soc/intel/sst/sst.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/sound/soc/intel/sst/sst.c b/sound/soc/intel/sst/sst.c index fdada40..f9a6d6d 100644 --- a/sound/soc/intel/sst/sst.c +++ b/sound/soc/intel/sst/sst.c @@ -206,6 +206,22 @@ void sst_process_pending_msg(struct work_struct *work) ctx->ops->post_message(ctx, NULL, false); } +static int sst_workqueue_init(struct intel_sst_drv *ctx) +{ + INIT_LIST_HEAD(&ctx->memcpy_list); + INIT_LIST_HEAD(&ctx->rx_list); + INIT_LIST_HEAD(&ctx->ipc_dispatch_list); + INIT_LIST_HEAD(&ctx->block_list); + INIT_WORK(&ctx->ipc_post_msg_wq, sst_process_pending_msg); + init_waitqueue_head(&ctx->wait_queue); + + ctx->post_msg_wq = + create_singlethread_workqueue("sst_post_msg_wq"); + if (!ctx->post_msg_wq) + return -EBUSY; + return 0; +} + /* * intel_sst_probe - PCI probe function * @@ -254,24 +270,13 @@ static int intel_sst_probe(struct pci_dev *pci, sst_drv_ctx->use_dma = 0; sst_drv_ctx->use_lli = 0; - INIT_LIST_HEAD(&sst_drv_ctx->memcpy_list); - INIT_LIST_HEAD(&sst_drv_ctx->ipc_dispatch_list); - INIT_LIST_HEAD(&sst_drv_ctx->block_list); - INIT_LIST_HEAD(&sst_drv_ctx->rx_list); - - sst_drv_ctx->post_msg_wq = - create_singlethread_workqueue("sst_post_msg_wq"); - if (!sst_drv_ctx->post_msg_wq) { - ret = -EINVAL; - goto do_free_drv_ctx; - } - INIT_WORK(&sst_drv_ctx->ipc_post_msg_wq, sst_process_pending_msg); - init_waitqueue_head(&sst_drv_ctx->wait_queue); - spin_lock_init(&sst_drv_ctx->ipc_spin_lock); spin_lock_init(&sst_drv_ctx->block_lock); spin_lock_init(&sst_drv_ctx->rx_msg_lock); + if (sst_workqueue_init(sst_drv_ctx)) + return -EINVAL; + dev_info(sst_drv_ctx->dev, "Got drv data max stream %d\n", sst_drv_ctx->info.max_streams); for (i = 1; i <= sst_drv_ctx->info.max_streams; i++) { @@ -414,7 +419,6 @@ do_release_regions: pci_release_regions(pci); do_free_mem: destroy_workqueue(sst_drv_ctx->post_msg_wq); -do_free_drv_ctx: dev_err(sst_drv_ctx->dev, "Probe failed with %d\n", ret); return ret; } |