Re: [PATCH 5/9] drm/i915: Rename drm_gem_object_unreference in preparation for lockless free

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20/07/16 12:43, Joonas Lahtinen wrote:
On ke, 2016-07-20 at 09:59 +0100, Chris Wilson wrote:

diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
index 605c69658d2c..75a1496ceb6f 100644
--- a/drivers/gpu/drm/i915/intel_guc_loader.c
+++ b/drivers/gpu/drm/i915/intel_guc_loader.c
@@ -737,13 +737,15 @@ void intel_guc_fini(struct drm_device *dev)
  	struct drm_i915_private *dev_priv = to_i915(dev);
  	struct intel_guc_fw *guc_fw = &dev_priv->guc.guc_fw;

+	if (!guc_fw->guc_fw_obj)
+		return;
+

This is definitely not a mechanical change, should be split to separate
patch (maybe outside of this series too).

With that split out,

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>

Regards, Joonas

  	mutex_lock(&dev->struct_mutex);
  	direct_interrupts_to_host(dev_priv);
  	i915_guc_submission_disable(dev_priv);
  	i915_guc_submission_fini(dev_priv);

-	if (guc_fw->guc_fw_obj)
-		drm_gem_object_unreference(&guc_fw->guc_fw_obj->base);
+	i915_gem_object_put(guc_fw->guc_fw_obj);
  	guc_fw->guc_fw_obj = NULL;
  	mutex_unlock(&dev->struct_mutex);

In my version of this set of transformations, I allowed the reference-releasing function (equivalent to i915_gem_object_put() here) to be called with NULL as a parameter; drm_gem_object_unreference() can already handle NULL, and since we now guarantee gem-obj == NULL <=> i915-obj == NULL, it's safe to pass it though. That allows quite a few simplifications in various bits of cleanup code.

.Dave.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux