Commit ba6976c1 authored by Daniel Vetter's avatar Daniel Vetter

drm: Convert drm_legacy_ctxbitmap_init to void return type

It can't fail really.

Also remove the redundant kms check Peter added.

Cc: Peter Antoine <peter.antoine@intel.com>
Reviewed-by: default avatarPeter Antoine <peter.antoine@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
parent 0e975980
...@@ -89,14 +89,13 @@ static int drm_legacy_ctxbitmap_next(struct drm_device * dev) ...@@ -89,14 +89,13 @@ static int drm_legacy_ctxbitmap_next(struct drm_device * dev)
* *
* Initialise the drm_device::ctx_idr * Initialise the drm_device::ctx_idr
*/ */
int drm_legacy_ctxbitmap_init(struct drm_device * dev) void drm_legacy_ctxbitmap_init(struct drm_device * dev)
{ {
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
drm_core_check_feature(dev, DRIVER_MODESET)) drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL; return;
idr_init(&dev->ctx_idr); idr_init(&dev->ctx_idr);
return 0;
} }
/** /**
......
...@@ -582,14 +582,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver, ...@@ -582,14 +582,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,
if (drm_ht_create(&dev->map_hash, 12)) if (drm_ht_create(&dev->map_hash, 12))
goto err_minors; goto err_minors;
if (drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) || drm_legacy_ctxbitmap_init(dev);
!drm_core_check_feature(dev, DRIVER_MODESET))
ret = drm_legacy_ctxbitmap_init(dev);
if (ret) {
DRM_ERROR(
"Cannot allocate memory for context bitmap.\n");
goto err_ht;
}
if (drm_core_check_feature(dev, DRIVER_GEM)) { if (drm_core_check_feature(dev, DRIVER_GEM)) {
ret = drm_gem_init(dev); ret = drm_gem_init(dev);
...@@ -603,7 +596,6 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver, ...@@ -603,7 +596,6 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,
err_ctxbitmap: err_ctxbitmap:
drm_legacy_ctxbitmap_cleanup(dev); drm_legacy_ctxbitmap_cleanup(dev);
err_ht:
drm_ht_remove(&dev->map_hash); drm_ht_remove(&dev->map_hash);
err_minors: err_minors:
drm_minor_free(dev, DRM_MINOR_LEGACY); drm_minor_free(dev, DRM_MINOR_LEGACY);
......
...@@ -42,7 +42,7 @@ struct drm_file; ...@@ -42,7 +42,7 @@ struct drm_file;
#define DRM_KERNEL_CONTEXT 0 #define DRM_KERNEL_CONTEXT 0
#define DRM_RESERVED_CONTEXTS 1 #define DRM_RESERVED_CONTEXTS 1
int drm_legacy_ctxbitmap_init(struct drm_device *dev); void drm_legacy_ctxbitmap_init(struct drm_device *dev);
void drm_legacy_ctxbitmap_cleanup(struct drm_device *dev); void drm_legacy_ctxbitmap_cleanup(struct drm_device *dev);
void drm_legacy_ctxbitmap_free(struct drm_device *dev, int ctx_handle); void drm_legacy_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file); void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file);
......
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