Commit 5a8b7cf9 authored by Gerd Hoffmann's avatar Gerd Hoffmann

drm/vram: switch vram helper to &drm_gem_object_funcs.mmap()

Wire up the new drm_gem_ttm_mmap() helper function,
use generic drm_gem_mmap for &fops.mmap and
delete dead drm_vram_mm_file_operations_mmap().
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20191016115203.20095-10-kraxel@redhat.com
parent 231927d9
...@@ -737,6 +737,7 @@ static const struct drm_gem_object_funcs drm_gem_vram_object_funcs = { ...@@ -737,6 +737,7 @@ static const struct drm_gem_object_funcs drm_gem_vram_object_funcs = {
.unpin = drm_gem_vram_object_unpin, .unpin = drm_gem_vram_object_unpin,
.vmap = drm_gem_vram_object_vmap, .vmap = drm_gem_vram_object_vmap,
.vunmap = drm_gem_vram_object_vunmap, .vunmap = drm_gem_vram_object_vunmap,
.mmap = drm_gem_ttm_mmap,
.print_info = drm_gem_ttm_print_info, .print_info = drm_gem_ttm_print_info,
}; };
...@@ -971,12 +972,6 @@ static void drm_vram_mm_cleanup(struct drm_vram_mm *vmm) ...@@ -971,12 +972,6 @@ static void drm_vram_mm_cleanup(struct drm_vram_mm *vmm)
ttm_bo_device_release(&vmm->bdev); ttm_bo_device_release(&vmm->bdev);
} }
static int drm_vram_mm_mmap(struct file *filp, struct vm_area_struct *vma,
struct drm_vram_mm *vmm)
{
return ttm_bo_mmap(filp, vma, &vmm->bdev);
}
/* /*
* Helpers for integration with struct drm_device * Helpers for integration with struct drm_device
*/ */
...@@ -1032,30 +1027,3 @@ void drm_vram_helper_release_mm(struct drm_device *dev) ...@@ -1032,30 +1027,3 @@ void drm_vram_helper_release_mm(struct drm_device *dev)
dev->vram_mm = NULL; dev->vram_mm = NULL;
} }
EXPORT_SYMBOL(drm_vram_helper_release_mm); EXPORT_SYMBOL(drm_vram_helper_release_mm);
/*
* Helpers for &struct file_operations
*/
/**
* drm_vram_mm_file_operations_mmap() - \
Implements &struct file_operations.mmap()
* @filp: the mapping's file structure
* @vma: the mapping's memory area
*
* Returns:
* 0 on success, or
* a negative error code otherwise.
*/
int drm_vram_mm_file_operations_mmap(
struct file *filp, struct vm_area_struct *vma)
{
struct drm_file *file_priv = filp->private_data;
struct drm_device *dev = file_priv->minor->dev;
if (WARN_ONCE(!dev->vram_mm, "VRAM MM not initialized"))
return -EINVAL;
return drm_vram_mm_mmap(filp, vma, dev->vram_mm);
}
EXPORT_SYMBOL(drm_vram_mm_file_operations_mmap);
...@@ -184,13 +184,6 @@ struct drm_vram_mm *drm_vram_helper_alloc_mm( ...@@ -184,13 +184,6 @@ struct drm_vram_mm *drm_vram_helper_alloc_mm(
struct drm_device *dev, uint64_t vram_base, size_t vram_size); struct drm_device *dev, uint64_t vram_base, size_t vram_size);
void drm_vram_helper_release_mm(struct drm_device *dev); void drm_vram_helper_release_mm(struct drm_device *dev);
/*
* Helpers for &struct file_operations
*/
int drm_vram_mm_file_operations_mmap(
struct file *filp, struct vm_area_struct *vma);
/** /**
* define DRM_VRAM_MM_FILE_OPERATIONS - default callback functions for \ * define DRM_VRAM_MM_FILE_OPERATIONS - default callback functions for \
&struct file_operations &struct file_operations
...@@ -204,7 +197,7 @@ int drm_vram_mm_file_operations_mmap( ...@@ -204,7 +197,7 @@ int drm_vram_mm_file_operations_mmap(
.poll = drm_poll, \ .poll = drm_poll, \
.unlocked_ioctl = drm_ioctl, \ .unlocked_ioctl = drm_ioctl, \
.compat_ioctl = drm_compat_ioctl, \ .compat_ioctl = drm_compat_ioctl, \
.mmap = drm_vram_mm_file_operations_mmap, \ .mmap = drm_gem_mmap, \
.open = drm_open, \ .open = drm_open, \
.release = drm_release \ .release = drm_release \
......
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