@@ -77,13 +77,6 @@ struct drm_vram_mm *drm_vram_helper_alloc_mm(
const struct drm_vram_mm_funcs *funcs);
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 \
&struct file_operations
@@ -97,7 +90,7 @@ int drm_vram_mm_file_operations_mmap(
.poll = drm_poll, \
.unlocked_ioctl = drm_ioctl, \
.compat_ioctl = drm_compat_ioctl, \
- .mmap = drm_vram_mm_file_operations_mmap, \
+ .mmap = drm_gem_mmap, \
.open = drm_open, \
.release = drm_release \
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
+#include <drm/drm_gem_ttm_helper.h>
#include <drm/drm_gem_vram_helper.h>
#include <drm/drm_device.h>
#include <drm/drm_mode.h>
@@ -585,5 +586,6 @@ static const struct drm_gem_object_funcs drm_gem_vram_object_funcs = {
.pin = drm_gem_vram_object_pin,
.unpin = drm_gem_vram_object_unpin,
.vmap = drm_gem_vram_object_vmap,
- .vunmap = drm_gem_vram_object_vunmap
+ .vunmap = drm_gem_vram_object_vunmap,
+ .mmap = drm_gem_ttm_mmap,
};
@@ -268,30 +268,3 @@ void drm_vram_helper_release_mm(struct drm_device *dev)
dev->vram_mm = NULL;
}
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);
... using the new drm_gem_ttm_mmap() helper function. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- include/drm/drm_vram_mm_helper.h | 9 +-------- drivers/gpu/drm/drm_gem_vram_helper.c | 4 +++- drivers/gpu/drm/drm_vram_mm_helper.c | 27 --------------------------- 3 files changed, 4 insertions(+), 36 deletions(-)