Commit 7e73e4d8 authored by Subhransu S. Prusty's avatar Subhransu S. Prusty Committed by Mark Brown

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: default avatarSubhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 3172fcdd
......@@ -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 @@ static int intel_sst_probe(struct pci_dev *pci,
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;
}
......
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