diff mbox

drm/i915: grab struct_mutex at intel_edp_psr_enable()

Message ID 1406918955-1876-1-git-send-email-przanoni@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paulo Zanoni Aug. 1, 2014, 6:49 p.m. UTC
From: Paulo Zanoni <paulo.r.zanoni@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@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox

Patch

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)