Commit ccd9fe97 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/ttm: Don't override vm_ops callbacks, if set

Drivers may want to set their own callbacks for a VM area. Only set
TTM's callbacks if the vm_ops field is clear.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210525151055.8174-2-tzimmermann@suse.de
parent 8eca89a1
......@@ -586,7 +586,12 @@ static struct ttm_buffer_object *ttm_bo_vm_lookup(struct ttm_device *bdev,
static void ttm_bo_mmap_vma_setup(struct ttm_buffer_object *bo, struct vm_area_struct *vma)
{
vma->vm_ops = &ttm_bo_vm_ops;
/*
* Drivers may want to override the vm_ops field. Otherwise we
* use TTM's default callbacks.
*/
if (!vma->vm_ops)
vma->vm_ops = &ttm_bo_vm_ops;
/*
* Note: We're transferring the bo reference to
......
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