drm/core: use helper to check driver features
authorAndrzej Hajda <a.hajda@samsung.com>
Tue, 30 Sep 2014 14:49:56 +0000 (16:49 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 3 Oct 2014 08:38:56 +0000 (10:38 +0200)
The patch replaces direct access to driver_features field
by calls to helper function.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/drm_drv.c
drivers/gpu/drm/drm_fops.c
drivers/gpu/drm/drm_gem.c

index 8889f8ec50ab31d871e1070dd91af828390ddc5b..bc3da32d458590a849a785aeca890670741e5212 100644 (file)
@@ -595,7 +595,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,
                goto err_ht;
        }
 
-       if (driver->driver_features & DRIVER_GEM) {
+       if (drm_core_check_feature(dev, DRIVER_GEM)) {
                ret = drm_gem_init(dev);
                if (ret) {
                        DRM_ERROR("Cannot initialize graphics execution manager (GEM)\n");
@@ -625,7 +625,7 @@ static void drm_dev_release(struct kref *ref)
 {
        struct drm_device *dev = container_of(ref, struct drm_device, ref);
 
-       if (dev->driver->driver_features & DRIVER_GEM)
+       if (drm_core_check_feature(dev, DRIVER_GEM))
                drm_gem_destroy(dev);
 
        drm_legacy_ctxbitmap_cleanup(dev);
index 3e6694633f42af404fcb3979fc69a81f06b1a929..ed7bc68f7e8700041894c7f35685af449c4deb2e 100644 (file)
@@ -171,7 +171,7 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
        init_waitqueue_head(&priv->event_wait);
        priv->event_space = 4096; /* set aside 4k for event buffer */
 
-       if (dev->driver->driver_features & DRIVER_GEM)
+       if (drm_core_check_feature(dev, DRIVER_GEM))
                drm_gem_open(dev, priv);
 
        if (drm_core_check_feature(dev, DRIVER_PRIME))
@@ -256,7 +256,7 @@ out_close:
 out_prime_destroy:
        if (drm_core_check_feature(dev, DRIVER_PRIME))
                drm_prime_destroy_file_private(&priv->prime);
-       if (dev->driver->driver_features & DRIVER_GEM)
+       if (drm_core_check_feature(dev, DRIVER_GEM))
                drm_gem_release(dev, priv);
        put_pid(priv->pid);
        kfree(priv);
@@ -408,10 +408,10 @@ int drm_release(struct inode *inode, struct file *filp)
 
        drm_events_release(file_priv);
 
-       if (dev->driver->driver_features & DRIVER_MODESET)
+       if (drm_core_check_feature(dev, DRIVER_MODESET))
                drm_fb_release(file_priv);
 
-       if (dev->driver->driver_features & DRIVER_GEM)
+       if (drm_core_check_feature(dev, DRIVER_GEM))
                drm_gem_release(dev, file_priv);
 
        drm_legacy_ctxbitmap_flush(dev, file_priv);
index cd45e45e2cced25944fe73ff2dd84b193f9f36cf..f6ca51259fa3a90dbc46fff70d8e15dc5e483ba8 100644 (file)
@@ -581,7 +581,7 @@ drm_gem_close_ioctl(struct drm_device *dev, void *data,
        struct drm_gem_close *args = data;
        int ret;
 
-       if (!(dev->driver->driver_features & DRIVER_GEM))
+       if (!drm_core_check_feature(dev, DRIVER_GEM))
                return -ENODEV;
 
        ret = drm_gem_handle_delete(file_priv, args->handle);
@@ -608,7 +608,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
        struct drm_gem_object *obj;
        int ret;
 
-       if (!(dev->driver->driver_features & DRIVER_GEM))
+       if (!drm_core_check_feature(dev, DRIVER_GEM))
                return -ENODEV;
 
        obj = drm_gem_object_lookup(dev, file_priv, args->handle);
@@ -661,7 +661,7 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,
        int ret;
        u32 handle;
 
-       if (!(dev->driver->driver_features & DRIVER_GEM))
+       if (!drm_core_check_feature(dev, DRIVER_GEM))
                return -ENODEV;
 
        mutex_lock(&dev->object_name_lock);