Merge "dsp: Add cmd locks to fix synchronization issues"

This commit is contained in:
qctecmdr 2019-11-27 20:28:48 -08:00 • committed by Gerrit - the friendly Code Review server
commit 2d5f55cacf

View file

@ -502,6 +502,7 @@ static int q6core_send_get_avcs_fwk_ver_cmd(void)
struct apr_hdr avcs_ver_cmd;
int ret;
mutex_lock(&q6core_lcl.cmd_lock);
avcs_ver_cmd.hdr_field =
APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, APR_HDR_LEN(APR_HDR_SIZE),
APR_PKT_VER);
@ -548,6 +549,7 @@ static int q6core_send_get_avcs_fwk_ver_cmd(void)
ret = 0;
done:
mutex_unlock(&q6core_lcl.cmd_lock);
return ret;
}
@ -1428,14 +1430,16 @@ int q6core_map_mdf_shared_memory(uint32_t map_handle, uint64_t *buf_add,
int i = 0;
int cmd_size = 0;
mutex_lock(&q6core_lcl.cmd_lock);
cmd_size = sizeof(struct avs_cmd_map_mdf_shared_memory)
+ sizeof(struct avs_shared_map_region_payload)
* bufcnt;
mmap_region_cmd = kzalloc(cmd_size, GFP_KERNEL);
if (mmap_region_cmd == NULL)
if (mmap_region_cmd == NULL) {
mutex_unlock(&q6core_lcl.cmd_lock);
return -ENOMEM;
}
mmap_regions = (struct avs_cmd_map_mdf_shared_memory *)mmap_region_cmd;
mmap_regions->hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
APR_HDR_LEN(APR_HDR_SIZE),
@ -1502,6 +1506,7 @@ int q6core_map_mdf_shared_memory(uint32_t map_handle, uint64_t *buf_add,
done:
kfree(mmap_region_cmd);
mutex_unlock(&q6core_lcl.cmd_lock);
return ret;
}