drm/armada: Introduce GEM object functions
authorThomas Zimmermann <tzimmermann@suse.de>
Wed, 23 Sep 2020 10:21:39 +0000 (12:21 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Fri, 25 Sep 2020 07:20:13 +0000 (09:20 +0200)
GEM object functions deprecate several similar callback interfaces in
struct drm_driver. This patch replaces the per-driver callbacks with
per-instance callbacks in armada.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Acked-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200923102159.24084-3-tzimmermann@suse.de
drivers/gpu/drm/armada/armada_drv.c
drivers/gpu/drm/armada/armada_gem.c
drivers/gpu/drm/armada/armada_gem.h

index 980d3f1..22247cf 100644 (file)
@@ -37,13 +37,10 @@ DEFINE_DRM_GEM_FOPS(armada_drm_fops);
 
 static struct drm_driver armada_drm_driver = {
        .lastclose              = drm_fb_helper_lastclose,
-       .gem_free_object_unlocked = armada_gem_free_object,
        .prime_handle_to_fd     = drm_gem_prime_handle_to_fd,
        .prime_fd_to_handle     = drm_gem_prime_fd_to_handle,
-       .gem_prime_export       = armada_gem_prime_export,
        .gem_prime_import       = armada_gem_prime_import,
        .dumb_create            = armada_gem_dumb_create,
-       .gem_vm_ops             = &armada_gem_vm_ops,
        .major                  = 1,
        .minor                  = 0,
        .name                   = "armada-drm",
index ecf8a55..c343fbe 100644 (file)
@@ -25,7 +25,7 @@ static vm_fault_t armada_gem_vm_fault(struct vm_fault *vmf)
        return vmf_insert_pfn(vmf->vma, vmf->address, pfn);
 }
 
-const struct vm_operations_struct armada_gem_vm_ops = {
+static const struct vm_operations_struct armada_gem_vm_ops = {
        .fault  = armada_gem_vm_fault,
        .open   = drm_gem_vm_open,
        .close  = drm_gem_vm_close,
@@ -184,6 +184,12 @@ armada_gem_map_object(struct drm_device *dev, struct armada_gem_object *dobj)
        return dobj->addr;
 }
 
+static const struct drm_gem_object_funcs armada_gem_object_funcs = {
+       .free = armada_gem_free_object,
+       .export = armada_gem_prime_export,
+       .vm_ops = &armada_gem_vm_ops,
+};
+
 struct armada_gem_object *
 armada_gem_alloc_private_object(struct drm_device *dev, size_t size)
 {
@@ -195,6 +201,8 @@ armada_gem_alloc_private_object(struct drm_device *dev, size_t size)
        if (!obj)
                return NULL;
 
+       obj->obj.funcs = &armada_gem_object_funcs;
+
        drm_gem_private_object_init(dev, &obj->obj, size);
 
        DRM_DEBUG_DRIVER("alloc private obj %p size %zu\n", obj, size);
@@ -214,6 +222,8 @@ static struct armada_gem_object *armada_gem_alloc_object(struct drm_device *dev,
        if (!obj)
                return NULL;
 
+       obj->obj.funcs = &armada_gem_object_funcs;
+
        if (drm_gem_object_init(dev, &obj->obj, size)) {
                kfree(obj);
                return NULL;
index de04cc2..ffcc7e8 100644 (file)
@@ -21,8 +21,6 @@ struct armada_gem_object {
        void                    *update_data;
 };
 
-extern const struct vm_operations_struct armada_gem_vm_ops;
-
 #define drm_to_armada_gem(o) container_of(o, struct armada_gem_object, obj)
 
 void armada_gem_free_object(struct drm_gem_object *);