drm: Convert drm_legacy_ctxbitmap_init to void return type
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 23 Jun 2015 09:22:36 +0000 (11:22 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 2 Jul 2015 15:00:48 +0000 (17:00 +0200)
It can't fail really.

Also remove the redundant kms check Peter added.

Cc: Peter Antoine <peter.antoine@intel.com>
Reviewed-by: Peter Antoine <peter.antoine@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
drivers/gpu/drm/drm_context.c
drivers/gpu/drm/drm_drv.c
drivers/gpu/drm/drm_legacy.h

index 32958dabd7b0fe10b5e53e1f7134d973285294bf..192a5f9eeb74213610fdf8f4a10529fdf88555ea 100644 (file)
@@ -89,14 +89,13 @@ static int drm_legacy_ctxbitmap_next(struct drm_device * dev)
  *
  * 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) &&
            drm_core_check_feature(dev, DRIVER_MODESET))
-               return -EINVAL;
+               return;
 
        idr_init(&dev->ctx_idr);
-       return 0;
 }
 
 /**
index 838657503113cce1dd88adabaa7b9b14c9cc2a84..9b51fe11ff192eb3b98f51c1a2a170bac895294d 100644 (file)
@@ -582,14 +582,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,
        if (drm_ht_create(&dev->map_hash, 12))
                goto err_minors;
 
-       if (drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) ||
-               !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;
-               }
+       drm_legacy_ctxbitmap_init(dev);
 
        if (drm_core_check_feature(dev, DRIVER_GEM)) {
                ret = drm_gem_init(dev);
@@ -603,7 +596,6 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,
 
 err_ctxbitmap:
        drm_legacy_ctxbitmap_cleanup(dev);
-err_ht:
        drm_ht_remove(&dev->map_hash);
 err_minors:
        drm_minor_free(dev, DRM_MINOR_LEGACY);
index c1dc61473db58b1a518c65eae09f25f00fa6fffc..9b731786e4db2d90b95ff6020e253b0c6f883ee7 100644 (file)
@@ -42,7 +42,7 @@ struct drm_file;
 #define DRM_KERNEL_CONTEXT             0
 #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_free(struct drm_device *dev, int ctx_handle);
 void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file);