@@ -163,7 +163,7 @@ struct process_context {
/* DMM mapped memory resources */
struct list_head dmm_map_list;
- spinlock_t dmm_map_lock;
+ struct semaphore dmm_map_sema;
/* DMM reserved memory resources */
struct list_head dmm_rsv_list;
@@ -507,7 +507,7 @@ static int bridge_open(struct inode *ip, struct file *filp)
pr_ctxt = kzalloc(sizeof(struct process_context), GFP_KERNEL);
if (pr_ctxt) {
pr_ctxt->res_state = PROC_RES_ALLOCATED;
- spin_lock_init(&pr_ctxt->dmm_map_lock);
+ sema_init(&pr_ctxt->dmm_map_sema, 1);
INIT_LIST_HEAD(&pr_ctxt->dmm_map_list);
spin_lock_init(&pr_ctxt->dmm_rsv_lock);
INIT_LIST_HEAD(&pr_ctxt->dmm_rsv_list);
@@ -144,9 +144,9 @@ static struct dmm_map_object *add_mapping_info(struct process_context *pr_ctxt,
map_obj->size = size;
map_obj->num_usr_pgs = num_usr_pgs;
- spin_lock(&pr_ctxt->dmm_map_lock);
+ down(&pr_ctxt->dmm_map_sema);
list_add(&map_obj->link, &pr_ctxt->dmm_map_list);
- spin_unlock(&pr_ctxt->dmm_map_lock);
+ up(&pr_ctxt->dmm_map_sema);
return map_obj;
}
@@ -170,7 +170,7 @@ static void remove_mapping_information(struct process_context *pr_ctxt,
pr_debug("%s: looking for virt 0x%x size 0x%x\n", __func__,
dsp_addr, size);
- spin_lock(&pr_ctxt->dmm_map_lock);
+ down(&pr_ctxt->dmm_map_sema);
list_for_each_entry(map_obj, &pr_ctxt->dmm_map_list, link) {
pr_debug("%s: candidate: mpu_addr 0x%x virt 0x%x size 0x%x\n",
__func__,
@@ -191,7 +191,7 @@ static void remove_mapping_information(struct process_context *pr_ctxt,
pr_err("%s: failed to find given map info\n", __func__);
out:
- spin_unlock(&pr_ctxt->dmm_map_lock);
+ up(&pr_ctxt->dmm_map_sema);
}
static int match_containing_map_obj(struct dmm_map_object *map_obj,
@@ -211,7 +211,7 @@ static struct dmm_map_object *find_containing_mapping(
pr_debug("%s: looking for mpu_addr 0x%x size 0x%x\n", __func__,
mpu_addr, size);
- spin_lock(&pr_ctxt->dmm_map_lock);
+ down(&pr_ctxt->dmm_map_sema);
list_for_each_entry(map_obj, &pr_ctxt->dmm_map_list, link) {
pr_debug("%s: candidate: mpu_addr 0x%x virt 0x%x size 0x%x\n",
__func__,
@@ -228,7 +228,7 @@ static struct dmm_map_object *find_containing_mapping(
map_obj = NULL;
out:
- spin_unlock(&pr_ctxt->dmm_map_lock);
+ up(&pr_ctxt->dmm_map_sema);
return map_obj;
}