@@ -51,12 +51,6 @@ static const struct file_operations vkms_driver_fops = {
.release = drm_release,
};
-static const struct vm_operations_struct vkms_gem_vm_ops = {
- .fault = vkms_gem_fault,
- .open = drm_gem_vm_open,
- .close = drm_gem_vm_close,
-};
-
static void vkms_release(struct drm_device *dev)
{
struct vkms_device *vkms = container_of(dev, struct vkms_device, drm);
@@ -101,8 +95,6 @@ static struct drm_driver vkms_driver = {
.release = vkms_release,
.fops = &vkms_driver_fops,
.dumb_create = vkms_dumb_create,
- .gem_vm_ops = &vkms_gem_vm_ops,
- .gem_free_object_unlocked = vkms_gem_free_object,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
.gem_prime_import_sg_table = vkms_prime_import_sg_table,
@@ -117,13 +117,9 @@ struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev,
enum drm_plane_type type, int index);
/* Gem stuff */
-vm_fault_t vkms_gem_fault(struct vm_fault *vmf);
-
int vkms_dumb_create(struct drm_file *file, struct drm_device *dev,
struct drm_mode_create_dumb *args);
-void vkms_gem_free_object(struct drm_gem_object *obj);
-
int vkms_gem_vmap(struct drm_gem_object *obj);
void vkms_gem_vunmap(struct drm_gem_object *obj);
@@ -7,6 +7,20 @@
#include "vkms_drv.h"
+static vm_fault_t vkms_gem_fault(struct vm_fault *vmf);
+static void vkms_gem_free_object(struct drm_gem_object *obj);
+
+static const struct vm_operations_struct vkms_gem_vm_ops = {
+ .fault = vkms_gem_fault,
+ .open = drm_gem_vm_open,
+ .close = drm_gem_vm_close,
+};
+
+static struct drm_gem_object_funcs vkms_gem_funcs = {
+ .free = vkms_gem_free_object,
+ .vm_ops = &vkms_gem_vm_ops
+};
+
static struct vkms_gem_object *__vkms_gem_create(struct drm_device *dev,
u64 size)
{
@@ -19,6 +33,8 @@ static struct vkms_gem_object *__vkms_gem_create(struct drm_device *dev,
size = roundup(size, PAGE_SIZE);
ret = drm_gem_object_init(dev, &obj->gem, size);
+ obj->gem.funcs = &vkms_gem_funcs;
+
if (ret) {
kfree(obj);
return ERR_PTR(ret);
@@ -29,7 +45,7 @@ static struct vkms_gem_object *__vkms_gem_create(struct drm_device *dev,
return obj;
}
-void vkms_gem_free_object(struct drm_gem_object *obj)
+static void vkms_gem_free_object(struct drm_gem_object *obj)
{
struct vkms_gem_object *gem = container_of(obj, struct vkms_gem_object,
gem);
@@ -42,7 +58,7 @@ void vkms_gem_free_object(struct drm_gem_object *obj)
kfree(gem);
}
-vm_fault_t vkms_gem_fault(struct vm_fault *vmf)
+static vm_fault_t vkms_gem_fault(struct vm_fault *vmf)
{
struct vm_area_struct *vma = vmf->vma;
struct vkms_gem_object *obj = vma->vm_private_data;
@@ -97,6 +113,7 @@ vm_fault_t vkms_gem_fault(struct vm_fault *vmf)
return ret;
}
+
static struct drm_gem_object *vkms_gem_create(struct drm_device *dev,
struct drm_file *file,
u32 *handle,
gem_vm_ops and gem_free_object_unlocked function pointer is deprecated. This patch replace these functions with drm_gem_object_funcs. And functions used in drm_gem_object_funcs, vkms_gem_vm_ops and vkms_gem_free_object, are not used other file but vkms_gem.c. So these goes static functions. When creating vkms_gem_object, vkms_gem_funcs is used for drm_gem_object.funcs. Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Cc: Haneen Mohammed <hamohammed.sa@gmail.com> Cc: Melissa Wen <melissa.srw@gmail.com> Signed-off-by: Sidong Yang <realwakka@gmail.com> --- drivers/gpu/drm/vkms/vkms_drv.c | 8 -------- drivers/gpu/drm/vkms/vkms_drv.h | 4 ---- drivers/gpu/drm/vkms/vkms_gem.c | 21 +++++++++++++++++++-- 3 files changed, 19 insertions(+), 14 deletions(-)