Commit 1bcecfac authored by Andrzej Hajda's avatar Andrzej Hajda Committed by Daniel Vetter

drm/core: use helper to check driver features

The patch replaces direct access to driver_features field
by calls to helper function.
Signed-off-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Reviewed-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 5a11f7f8
...@@ -595,7 +595,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver, ...@@ -595,7 +595,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,
goto err_ht; goto err_ht;
} }
if (driver->driver_features & DRIVER_GEM) { if (drm_core_check_feature(dev, DRIVER_GEM)) {
ret = drm_gem_init(dev); ret = drm_gem_init(dev);
if (ret) { if (ret) {
DRM_ERROR("Cannot initialize graphics execution manager (GEM)\n"); DRM_ERROR("Cannot initialize graphics execution manager (GEM)\n");
...@@ -625,7 +625,7 @@ static void drm_dev_release(struct kref *ref) ...@@ -625,7 +625,7 @@ static void drm_dev_release(struct kref *ref)
{ {
struct drm_device *dev = container_of(ref, struct drm_device, 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_gem_destroy(dev);
drm_legacy_ctxbitmap_cleanup(dev); drm_legacy_ctxbitmap_cleanup(dev);
......
...@@ -171,7 +171,7 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor) ...@@ -171,7 +171,7 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
init_waitqueue_head(&priv->event_wait); init_waitqueue_head(&priv->event_wait);
priv->event_space = 4096; /* set aside 4k for event buffer */ 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); drm_gem_open(dev, priv);
if (drm_core_check_feature(dev, DRIVER_PRIME)) if (drm_core_check_feature(dev, DRIVER_PRIME))
...@@ -256,7 +256,7 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor) ...@@ -256,7 +256,7 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
out_prime_destroy: out_prime_destroy:
if (drm_core_check_feature(dev, DRIVER_PRIME)) if (drm_core_check_feature(dev, DRIVER_PRIME))
drm_prime_destroy_file_private(&priv->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); drm_gem_release(dev, priv);
put_pid(priv->pid); put_pid(priv->pid);
kfree(priv); kfree(priv);
...@@ -408,10 +408,10 @@ int drm_release(struct inode *inode, struct file *filp) ...@@ -408,10 +408,10 @@ int drm_release(struct inode *inode, struct file *filp)
drm_events_release(file_priv); 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); 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_gem_release(dev, file_priv);
drm_legacy_ctxbitmap_flush(dev, file_priv); drm_legacy_ctxbitmap_flush(dev, file_priv);
......
...@@ -581,7 +581,7 @@ drm_gem_close_ioctl(struct drm_device *dev, void *data, ...@@ -581,7 +581,7 @@ drm_gem_close_ioctl(struct drm_device *dev, void *data,
struct drm_gem_close *args = data; struct drm_gem_close *args = data;
int ret; int ret;
if (!(dev->driver->driver_features & DRIVER_GEM)) if (!drm_core_check_feature(dev, DRIVER_GEM))
return -ENODEV; return -ENODEV;
ret = drm_gem_handle_delete(file_priv, args->handle); ret = drm_gem_handle_delete(file_priv, args->handle);
...@@ -608,7 +608,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data, ...@@ -608,7 +608,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
struct drm_gem_object *obj; struct drm_gem_object *obj;
int ret; int ret;
if (!(dev->driver->driver_features & DRIVER_GEM)) if (!drm_core_check_feature(dev, DRIVER_GEM))
return -ENODEV; return -ENODEV;
obj = drm_gem_object_lookup(dev, file_priv, args->handle); obj = drm_gem_object_lookup(dev, file_priv, args->handle);
...@@ -661,7 +661,7 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data, ...@@ -661,7 +661,7 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,
int ret; int ret;
u32 handle; u32 handle;
if (!(dev->driver->driver_features & DRIVER_GEM)) if (!drm_core_check_feature(dev, DRIVER_GEM))
return -ENODEV; return -ENODEV;
mutex_lock(&dev->object_name_lock); mutex_lock(&dev->object_name_lock);
......
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