Blob Blame History Raw
From 5c28e3a567fed9c22cb79f01294b1aaefee344fd Mon Sep 17 00:00:00 2001
From: Imre Deak <imre.deak@intel.com>
Date: Mon, 8 Jul 2019 17:07:34 +0300
Subject: drm/i915: Clear the shared PLL from the put_dplls() hook
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Git-commit: 5c28e3a567fed9c22cb79f01294b1aaefee344fd
Patch-mainline: v5.4-rc1
References: bsc#1152489

For symmetry with the get_dplls() hook which sets the shared_dpll
pointer clear the same pointer from the put_dplls() hook.

While at it also constify the old crtc state.

v2:
- Constify the old crtc state. (Ville)

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190708140735.20198-1-imre.deak@intel.com
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/i915/display/intel_display.c  |  2 --
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 20 +++++++++++++------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index f09eda75711a..f07081815b80 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -13307,8 +13307,6 @@ static void intel_modeset_clear_plls(struct intel_atomic_state *state)
 		if (!needs_modeset(new_crtc_state))
 			continue;
 
-		new_crtc_state->shared_dpll = NULL;
-
 		intel_release_shared_dplls(state, crtc);
 	}
 }
diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
index 67cfe836286e..5c18f9012062 100644
--- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
+++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
@@ -323,13 +323,17 @@ static void intel_unreference_shared_dpll(struct intel_atomic_state *state,
 static void intel_put_dpll(struct intel_atomic_state *state,
 			   struct intel_crtc *crtc)
 {
-	struct intel_crtc_state *crtc_state =
+	const struct intel_crtc_state *old_crtc_state =
 		intel_atomic_get_old_crtc_state(state, crtc);
+	struct intel_crtc_state *new_crtc_state =
+		intel_atomic_get_new_crtc_state(state, crtc);
+
+	new_crtc_state->shared_dpll = NULL;
 
-	if (!crtc_state->shared_dpll)
+	if (!old_crtc_state->shared_dpll)
 		return;
 
-	intel_unreference_shared_dpll(state, crtc, crtc_state->shared_dpll);
+	intel_unreference_shared_dpll(state, crtc, old_crtc_state->shared_dpll);
 }
 
 /**
@@ -3015,13 +3019,17 @@ static bool icl_get_dplls(struct intel_atomic_state *state,
 static void icl_put_dplls(struct intel_atomic_state *state,
 			  struct intel_crtc *crtc)
 {
-	struct intel_crtc_state *crtc_state =
+	const struct intel_crtc_state *old_crtc_state =
 		intel_atomic_get_old_crtc_state(state, crtc);
+	struct intel_crtc_state *new_crtc_state =
+		intel_atomic_get_new_crtc_state(state, crtc);
 	enum icl_port_dpll_id id;
 
+	new_crtc_state->shared_dpll = NULL;
+
 	for (id = ICL_PORT_DPLL_DEFAULT; id < ICL_PORT_DPLL_COUNT; id++) {
-		struct icl_port_dpll *port_dpll =
-			&crtc_state->icl_port_dplls[id];
+		const struct icl_port_dpll *port_dpll =
+			&old_crtc_state->icl_port_dplls[id];
 
 		if (!port_dpll->pll)
 			continue;
-- 
2.28.0