[Intel-gfx] [PATCH] drm/i915: grab struct_mutex at intel_edp_psr_enable()

Paulo Zanoni przanoni at gmail.com
Fri Aug 1 20:49:15 CEST 2014


From: Paulo Zanoni <paulo.r.zanoni at intel.com>

Otherwise we will hit "lockdep_assert_held(&dev->struct_mutex)"
from intel_edp_psr_match_conditions(). This happens all the time on my
BDW machine: just boot it and you'll get it.

In this patch I just grab struct_mutex in the deepest possible place
(around psr.lock, otherwise lockdep complains).

Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 87d0489..a91142c 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1876,11 +1876,11 @@ void intel_edp_psr_enable(struct intel_dp *intel_dp)
 		return;
 	}
 
+	mutex_lock(&dev->struct_mutex);
 	mutex_lock(&dev_priv->psr.lock);
 	if (dev_priv->psr.enabled) {
 		DRM_DEBUG_KMS("PSR already in use\n");
-		mutex_unlock(&dev_priv->psr.lock);
-		return;
+		goto out;
 	}
 
 	dev_priv->psr.busy_frontbuffer_bits = 0;
@@ -1890,7 +1890,10 @@ void intel_edp_psr_enable(struct intel_dp *intel_dp)
 
 	if (intel_edp_psr_match_conditions(intel_dp))
 		dev_priv->psr.enabled = intel_dp;
+
+out:
 	mutex_unlock(&dev_priv->psr.lock);
+	mutex_unlock(&dev->struct_mutex);
 }
 
 void intel_edp_psr_disable(struct intel_dp *intel_dp)
-- 
2.0.1




More information about the Intel-gfx mailing list