drm/i915: More GEM init dev_priv cleanup
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Thu, 1 Dec 2016 14:16:39 +0000 (14:16 +0000)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Thu, 1 Dec 2016 18:01:16 +0000 (18:01 +0000)
Simplifies the code to pass the right parameter in.

v2: Commit message. (Joonas Lahtinen)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_context.c

index a7f85bdf8d66ddfebcc2ac1cb391e590458ee7ee..383bf1ac1bdd38136a518beadcc88d4c7cb7908a 100644 (file)
@@ -544,8 +544,8 @@ static const struct vga_switcheroo_client_ops i915_switcheroo_ops = {
 static void i915_gem_fini(struct drm_i915_private *dev_priv)
 {
        mutex_lock(&dev_priv->drm.struct_mutex);
-       i915_gem_cleanup_engines(&dev_priv->drm);
-       i915_gem_context_fini(&dev_priv->drm);
+       i915_gem_cleanup_engines(dev_priv);
+       i915_gem_context_fini(dev_priv);
        mutex_unlock(&dev_priv->drm.struct_mutex);
 
        rcu_barrier();
@@ -833,7 +833,7 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
        intel_init_display_hooks(dev_priv);
        intel_init_clock_gating_hooks(dev_priv);
        intel_init_audio_hooks(dev_priv);
-       ret = i915_gem_load_init(&dev_priv->drm);
+       ret = i915_gem_load_init(dev_priv);
        if (ret < 0)
                goto err_gvt;
 
@@ -861,7 +861,7 @@ err_workqueues:
 static void i915_driver_cleanup_early(struct drm_i915_private *dev_priv)
 {
        i915_perf_fini(dev_priv);
-       i915_gem_load_cleanup(&dev_priv->drm);
+       i915_gem_load_cleanup(dev_priv);
        i915_workqueues_cleanup(dev_priv);
 }
 
index bbc6d0f2d8bf2688f8e29cf51dc3f93d78456030..20bc0aef656a5064d6b09690c38fa0177f68aede 100644 (file)
@@ -2975,8 +2975,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);
-int i915_gem_load_init(struct drm_device *dev);
-void i915_gem_load_cleanup(struct drm_device *dev);
+int i915_gem_load_init(struct drm_i915_private *dev_priv);
+void i915_gem_load_cleanup(struct drm_i915_private *dev_priv);
 void i915_gem_load_init_fences(struct drm_i915_private *dev_priv);
 int i915_gem_freeze(struct drm_i915_private *dev_priv);
 int i915_gem_freeze_late(struct drm_i915_private *dev_priv);
@@ -3180,7 +3180,7 @@ void i915_gem_clflush_object(struct drm_i915_gem_object *obj, bool force);
 int __must_check i915_gem_init(struct drm_i915_private *dev_priv);
 int __must_check i915_gem_init_hw(struct drm_i915_private *dev_priv);
 void i915_gem_init_swizzling(struct drm_i915_private *dev_priv);
-void i915_gem_cleanup_engines(struct drm_device *dev);
+void i915_gem_cleanup_engines(struct drm_i915_private *dev_priv);
 int __must_check i915_gem_wait_for_idle(struct drm_i915_private *dev_priv,
                                        unsigned int flags);
 int __must_check i915_gem_suspend(struct drm_i915_private *dev_priv);
@@ -3269,7 +3269,7 @@ void i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj,
 /* i915_gem_context.c */
 int __must_check i915_gem_context_init(struct drm_i915_private *dev_priv);
 void i915_gem_context_lost(struct drm_i915_private *dev_priv);
-void i915_gem_context_fini(struct drm_device *dev);
+void i915_gem_context_fini(struct drm_i915_private *dev_priv);
 int i915_gem_context_open(struct drm_device *dev, struct drm_file *file);
 void i915_gem_context_close(struct drm_device *dev, struct drm_file *file);
 int i915_switch_context(struct drm_i915_gem_request *req);
index b2a2e5843dc8481b6844de864c605b433806f6af..59065ae0b1536ec88159828ae80d2e9e5ab9e782 100644 (file)
@@ -4480,9 +4480,8 @@ out_unlock:
 }
 
 void
-i915_gem_cleanup_engines(struct drm_device *dev)
+i915_gem_cleanup_engines(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
        struct intel_engine_cs *engine;
        enum intel_engine_id id;
 
@@ -4522,9 +4521,8 @@ i915_gem_load_init_fences(struct drm_i915_private *dev_priv)
 }
 
 int
-i915_gem_load_init(struct drm_device *dev)
+i915_gem_load_init(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
        int err = -ENOMEM;
 
        dev_priv->objects = KMEM_CACHE(drm_i915_gem_object, SLAB_HWCACHE_ALIGN);
@@ -4593,10 +4591,8 @@ err_out:
        return err;
 }
 
-void i915_gem_load_cleanup(struct drm_device *dev)
+void i915_gem_load_cleanup(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
-
        WARN_ON(!llist_empty(&dev_priv->mm.free_list));
 
        mutex_lock(&dev_priv->drm.struct_mutex);
index ea847e865137b95fe112810d7c012fee68b1103c..a57c22659a3c1c0b09f7e1f90c538a8093c3bb6e 100644 (file)
@@ -519,12 +519,11 @@ void i915_gem_context_lost(struct drm_i915_private *dev_priv)
        }
 }
 
-void i915_gem_context_fini(struct drm_device *dev)
+void i915_gem_context_fini(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
        struct i915_gem_context *dctx = dev_priv->kernel_context;
 
-       lockdep_assert_held(&dev->struct_mutex);
+       lockdep_assert_held(&dev_priv->drm.struct_mutex);
 
        context_close(dctx);
        dev_priv->kernel_context = NULL;