Commit 0797ac61 authored by Daniel Vetter's avatar Daniel Vetter

drm/vgem: Drop dev->struct_mutex

With the previous two changes it doesn't protect anything any more.

v2: Use _unlocked unreference variant.

v3: Appease gcc noise.
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1459330852-27668-13-git-send-email-daniel.vetter@ffwll.ch
parent 7f340a26
...@@ -89,7 +89,6 @@ int vgem_gem_get_pages(struct drm_vgem_gem_object *obj) ...@@ -89,7 +89,6 @@ int vgem_gem_get_pages(struct drm_vgem_gem_object *obj)
static int vgem_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) static int vgem_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
{ {
struct drm_vgem_gem_object *obj = vma->vm_private_data; struct drm_vgem_gem_object *obj = vma->vm_private_data;
struct drm_device *dev = obj->base.dev;
loff_t num_pages; loff_t num_pages;
pgoff_t page_offset; pgoff_t page_offset;
int ret; int ret;
...@@ -103,12 +102,8 @@ static int vgem_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -103,12 +102,8 @@ static int vgem_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
if (page_offset > num_pages) if (page_offset > num_pages)
return VM_FAULT_SIGBUS; return VM_FAULT_SIGBUS;
mutex_lock(&dev->struct_mutex);
ret = vm_insert_page(vma, (unsigned long)vmf->virtual_address, ret = vm_insert_page(vma, (unsigned long)vmf->virtual_address,
obj->pages[page_offset]); obj->pages[page_offset]);
mutex_unlock(&dev->struct_mutex);
switch (ret) { switch (ret) {
case 0: case 0:
return VM_FAULT_NOPAGE; return VM_FAULT_NOPAGE;
...@@ -205,12 +200,9 @@ int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev, ...@@ -205,12 +200,9 @@ int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev,
int ret = 0; int ret = 0;
struct drm_gem_object *obj; struct drm_gem_object *obj;
mutex_lock(&dev->struct_mutex);
obj = drm_gem_object_lookup(dev, file, handle); obj = drm_gem_object_lookup(dev, file, handle);
if (!obj) { if (!obj)
ret = -ENOENT; return -ENOENT;
goto unlock;
}
ret = drm_gem_create_mmap_offset(obj); ret = drm_gem_create_mmap_offset(obj);
if (ret) if (ret)
...@@ -223,9 +215,8 @@ int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev, ...@@ -223,9 +215,8 @@ int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev,
*offset = drm_vma_node_offset_addr(&obj->vma_node); *offset = drm_vma_node_offset_addr(&obj->vma_node);
unref: unref:
drm_gem_object_unreference(obj); drm_gem_object_unreference_unlocked(obj);
unlock:
mutex_unlock(&dev->struct_mutex);
return 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