drm/legacy: move map_hash create/destroy into inlines
authorDave Airlie <airlied@redhat.com>
Mon, 22 Apr 2019 23:40:54 +0000 (09:40 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 24 Apr 2019 02:32:16 +0000 (12:32 +1000)
This allows them to be removed later.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_drv.c
drivers/gpu/drm/drm_legacy.h

index 15b0fd5adaaf2760567ff61d63854296b4cad5c1..34109a0b31449c920997d03b799f5fcc49b530e2 100644 (file)
@@ -692,7 +692,7 @@ int drm_dev_init(struct drm_device *dev,
        if (ret)
                goto err_minors;
 
-       ret = drm_ht_create(&dev->map_hash, 12);
+       ret = drm_legacy_create_map_hash(dev);
        if (ret)
                goto err_minors;
 
@@ -717,7 +717,7 @@ err_setunique:
                drm_gem_destroy(dev);
 err_ctxbitmap:
        drm_legacy_ctxbitmap_cleanup(dev);
-       drm_ht_remove(&dev->map_hash);
+       drm_legacy_remove_map_hash(dev);
 err_minors:
        drm_minor_free(dev, DRM_MINOR_PRIMARY);
        drm_minor_free(dev, DRM_MINOR_RENDER);
@@ -792,7 +792,7 @@ void drm_dev_fini(struct drm_device *dev)
                drm_gem_destroy(dev);
 
        drm_legacy_ctxbitmap_cleanup(dev);
-       drm_ht_remove(&dev->map_hash);
+       drm_legacy_remove_map_hash(dev);
        drm_fs_inode_free(dev->anon_inode);
 
        drm_minor_free(dev, DRM_MINOR_PRIMARY);
index 974c2be6bcd57e4367cb74da45f9f98fb55eb088..ef419d500e51f200cec116c8669e098752353e69 100644 (file)
@@ -63,6 +63,16 @@ int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f);
 
 #define DRM_MAP_HASH_OFFSET 0x10000000
 
+static inline int drm_legacy_create_map_hash(struct drm_device *dev)
+{
+       return drm_ht_create(&dev->map_hash, 12);
+}
+
+static inline void drm_legacy_remove_map_hash(struct drm_device *dev)
+{
+       drm_ht_remove(&dev->map_hash);
+}
+
 int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
                            struct drm_file *file_priv);
 int drm_legacy_addmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);