struct hmm_buffer_object *bo,
unsigned int pgnr, void (*release) (struct hmm_buffer_object *))
{
+ unsigned long flags;
+
if (bdev == NULL) {
v4l2_warn(&atomisp_dev,
"NULL hmm_bo_device.\n");
/*
* add to active_bo_list
*/
- mutex_lock(&bdev->ablist_mutex);
+ spin_lock_irqsave(&bdev->ablist_lock, flags);
list_add_tail(&bo->list, &bdev->active_bo_list);
bo->status |= HMM_BO_ACTIVE;
- mutex_unlock(&bdev->ablist_mutex);
+ spin_unlock_irqrestore(&bdev->ablist_lock, flags);
return 0;
}
static void hmm_bo_release(struct hmm_buffer_object *bo)
{
struct hmm_bo_device *bdev;
+ unsigned long flags;
check_bo_null_return(bo, (void)0);
* remove it from buffer device's buffer object list.
*/
if (hmm_bo_activated(bo)) {
- mutex_lock(&bdev->ablist_mutex);
+ spin_lock_irqsave(&bdev->ablist_lock, flags);
list_del(&bo->list);
- mutex_unlock(&bdev->ablist_mutex);
+ spin_unlock_irqrestore(&bdev->ablist_lock, flags);
} else {
- mutex_lock(&bdev->fblist_mutex);
+ spin_lock_irqsave(&bdev->fblist_lock, flags);
list_del(&bo->list);
- mutex_unlock(&bdev->fblist_mutex);
+ spin_unlock_irqrestore(&bdev->fblist_lock, flags);
}
if (bo->release)
void hmm_bo_unactivate(struct hmm_buffer_object *bo)
{
struct hmm_bo_device *bdev;
+ unsigned long flags;
check_bo_null_return(bo, (void)0);
bdev = bo->bdev;
- mutex_lock(&bdev->ablist_mutex);
+ spin_lock_irqsave(&bdev->ablist_lock, flags);
list_del(&bo->list);
- mutex_unlock(&bdev->ablist_mutex);
+ spin_unlock_irqrestore(&bdev->ablist_lock, flags);
- mutex_lock(&bdev->fblist_mutex);
+ spin_lock_irqsave(&bdev->fblist_lock, flags);
list_add_tail(&bo->list, &bdev->free_bo_list);
bo->status &= (~HMM_BO_ACTIVE);
- mutex_unlock(&bdev->fblist_mutex);
+ spin_unlock_irqrestore(&bdev->fblist_lock, flags);
return;
INIT_LIST_HEAD(&bdev->free_bo_list);
INIT_LIST_HEAD(&bdev->active_bo_list);
- mutex_init(&bdev->fblist_mutex);
- mutex_init(&bdev->ablist_mutex);
+ spin_lock_init(&bdev->fblist_lock);
+ spin_lock_init(&bdev->ablist_lock);
bdev->flag = HMM_BO_DEVICE_INITED;
{
struct list_head *pos;
struct hmm_buffer_object *bo;
+ unsigned long flags;
check_bodev_null_return(bdev, NULL);
- mutex_lock(&bdev->ablist_mutex);
+ spin_lock_irqsave(&bdev->ablist_lock, flags);
list_for_each(pos, &bdev->active_bo_list) {
bo = list_to_hmm_bo(pos);
/* pass bo which has no vm_node allocated */
if (bo->vm_node->start == vaddr)
goto found;
}
- mutex_unlock(&bdev->ablist_mutex);
+ spin_unlock_irqrestore(&bdev->ablist_lock, flags);
return NULL;
found:
- mutex_unlock(&bdev->ablist_mutex);
+ spin_unlock_irqrestore(&bdev->ablist_lock, flags);
return bo;
}
{
struct list_head *pos;
struct hmm_buffer_object *bo;
+ unsigned long flags;
check_bodev_null_return(bdev, NULL);
- mutex_lock(&bdev->fblist_mutex);
+ spin_lock_irqsave(&bdev->fblist_lock, flags);
list_for_each(pos, &bdev->active_bo_list) {
bo = list_to_hmm_bo(pos);
/* pass bo which has no vm_node allocated */
if (in_range(bo->vm_node->start, bo->vm_node->size, vaddr))
goto found;
}
- mutex_unlock(&bdev->fblist_mutex);
+ spin_unlock_irqrestore(&bdev->fblist_lock, flags);
return NULL;
found:
- mutex_unlock(&bdev->fblist_mutex);
+ spin_unlock_irqrestore(&bdev->fblist_lock, flags);
return bo;
}
{
struct list_head *pos;
struct hmm_buffer_object *bo;
+ unsigned long flags;
check_bodev_null_return(bdev, NULL);
- mutex_lock(&bdev->fblist_mutex);
+ spin_lock_irqsave(&bdev->fblist_lock, flags);
list_for_each(pos, &bdev->free_bo_list) {
bo = list_to_hmm_bo(pos);
if (bo->pgnr == pgnr)
goto found;
}
- mutex_unlock(&bdev->fblist_mutex);
+ spin_unlock_irqrestore(&bdev->fblist_lock, flags);
return NULL;
found:
list_del(&bo->list);
- mutex_unlock(&bdev->fblist_mutex);
+ spin_unlock_irqrestore(&bdev->fblist_lock, flags);
- mutex_lock(&bdev->ablist_mutex);
+ spin_lock_irqsave(&bdev->ablist_lock, flags);
list_add(&bo->list, &bdev->active_bo_list);
- mutex_unlock(&bdev->ablist_mutex);
+ spin_unlock_irqrestore(&bdev->ablist_lock, flags);
return bo;
}
void hmm_bo_device_destroy_free_bo_list(struct hmm_bo_device *bdev)
{
struct hmm_buffer_object *bo;
+ unsigned long flags;
check_bodev_null_return(bdev, (void)0);
- mutex_lock(&bdev->fblist_mutex);
+ spin_lock_irqsave(&bdev->fblist_lock, flags);
while (!list_empty(&bdev->free_bo_list)) {
bo = list_first_entry(&bdev->free_bo_list,
struct hmm_buffer_object, list);
list_del(&bo->list);
hmm_bo_unref(bo);
}
- mutex_unlock(&bdev->fblist_mutex);
+ spin_unlock_irqrestore(&bdev->fblist_lock, flags);
}
/*
{
struct list_head *pos;
struct hmm_buffer_object *bo;
+ unsigned long flags;
check_bodev_null_return(bdev, (void)0);
- mutex_lock(&bdev->fblist_mutex);
+ spin_lock_irqsave(&bdev->fblist_lock, flags);
list_for_each(pos, &bdev->free_bo_list) {
bo = list_to_hmm_bo(pos);
/* pass bo which has no vm_node allocated */
if (bo->vm_node->start == vaddr)
goto found;
}
- mutex_unlock(&bdev->fblist_mutex);
+ spin_unlock_irqrestore(&bdev->fblist_lock, flags);
return;
found:
list_del(&bo->list);
- mutex_unlock(&bdev->fblist_mutex);
+ spin_unlock_irqrestore(&bdev->fblist_lock, flags);
hmm_bo_unref(bo);
}
{
struct list_head *pos;
struct hmm_buffer_object *bo;
+ unsigned long flags;
check_bodev_null_return(bdev, (void)0);
retry:
- mutex_lock(&bdev->fblist_mutex);
+ spin_lock_irqsave(&bdev->fblist_lock, flags);
list_for_each(pos, &bdev->free_bo_list) {
bo = list_to_hmm_bo(pos);
if (bo->pgnr == pgnr)
goto found;
}
- mutex_unlock(&bdev->fblist_mutex);
+ spin_unlock_irqrestore(&bdev->fblist_lock, flags);
return;
found:
list_del(&bo->list);
- mutex_unlock(&bdev->fblist_mutex);
+ spin_unlock_irqrestore(&bdev->fblist_lock, flags);
hmm_bo_unref(bo);
goto retry;
}