drm/i915: Sanitize i915_gem_load() init and clean-up
authorImre Deak <imre.deak@intel.com>
Tue, 19 Jan 2016 13:26:29 +0000 (15:26 +0200)
committerImre Deak <imre.deak@intel.com>
Wed, 27 Jan 2016 15:43:15 +0000 (17:43 +0200)
Factor out common clean-up code for the GEM load time init function.
Also rename i915_gem_load() to i915_gem_load_init() to have a better
match with its new clean-up function.

No functional change.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: David Weinehall <david.weinehall@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1453209992-25995-5-git-send-email-imre.deak@intel.com
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c

index adc5fe728bc52e249910a445fc89e525a8b0be32..348366cd471c438ef167c03bb13f1b7b6b200910 100644 (file)
@@ -1034,7 +1034,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
        intel_setup_mchbar(dev);
        intel_opregion_setup(dev);
 
-       i915_gem_load(dev);
+       i915_gem_load_init(dev);
        i915_gem_shrinker_init(dev_priv);
 
        /* On the 945G/GM, the chipset reports the MSI capability on the
@@ -1121,9 +1121,7 @@ out_uncore_fini:
        pci_iounmap(dev->pdev, dev_priv->regs);
 put_bridge:
        pci_dev_put(dev_priv->bridge_dev);
-       kmem_cache_destroy(dev_priv->requests);
-       kmem_cache_destroy(dev_priv->vmas);
-       kmem_cache_destroy(dev_priv->objects);
+       i915_gem_load_cleanup(dev);
 out_runtime_pm_put:
        intel_runtime_pm_put(dev_priv);
 
@@ -1215,9 +1213,7 @@ int i915_driver_unload(struct drm_device *dev)
        if (dev_priv->regs != NULL)
                pci_iounmap(dev->pdev, dev_priv->regs);
 
-       kmem_cache_destroy(dev_priv->requests);
-       kmem_cache_destroy(dev_priv->vmas);
-       kmem_cache_destroy(dev_priv->objects);
+       i915_gem_load_cleanup(dev);
        pci_dev_put(dev_priv->bridge_dev);
        kfree(dev_priv);
 
index abfb8c9e5a8c71910915006e59dbad9f5ec2ac9d..905e90f2595756a1a4c56c6d068abfb3091d8c95 100644 (file)
@@ -2848,7 +2848,8 @@ int i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
                                struct drm_file *file_priv);
 int i915_gem_wait_ioctl(struct drm_device *dev, void *data,
                        struct drm_file *file_priv);
-void i915_gem_load(struct drm_device *dev);
+void i915_gem_load_init(struct drm_device *dev);
+void i915_gem_load_cleanup(struct drm_device *dev);
 void *i915_gem_object_alloc(struct drm_device *dev);
 void i915_gem_object_free(struct drm_i915_gem_object *obj);
 void i915_gem_object_init(struct drm_i915_gem_object *obj,
index 7ce76c24a5c6cfc0378e71e9ae4636f4d9af6066..c1bb6a61745c2f21a3f8dbe2738fc98608dc5c71 100644 (file)
@@ -5034,7 +5034,7 @@ init_ring_lists(struct intel_engine_cs *ring)
 }
 
 void
-i915_gem_load(struct drm_device *dev)
+i915_gem_load_init(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
        int i;
@@ -5103,6 +5103,15 @@ i915_gem_load(struct drm_device *dev)
        mutex_init(&dev_priv->fb_tracking.lock);
 }
 
+void i915_gem_load_cleanup(struct drm_device *dev)
+{
+       struct drm_i915_private *dev_priv = to_i915(dev);
+
+       kmem_cache_destroy(dev_priv->requests);
+       kmem_cache_destroy(dev_priv->vmas);
+       kmem_cache_destroy(dev_priv->objects);
+}
+
 void i915_gem_release(struct drm_device *dev, struct drm_file *file)
 {
        struct drm_i915_file_private *file_priv = file->driver_priv;