diff mbox series

[1/8] drm/i915/dmc: simplify intel_dmc_load_program() conditions

Message ID 78278190db850fb83f594bc8635a3a7c082e2ce8.1647542120.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/dmc: cleanups | expand

Commit Message

Jani Nikula March 17, 2022, 6:36 p.m. UTC
intel_dmc_load_program() is only ever called when
intel_dmc_has_payload() is true. Move the condition within
intel_dmc_load_program() to let it be called directly.

Also note that intel_dmc_has_payload() will always return false when
HAS_DMC() is false. Remove the redundant check.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display_power.c |  6 +++---
 drivers/gpu/drm/i915/display/intel_dmc.c           | 11 +----------
 2 files changed, 4 insertions(+), 13 deletions(-)

Comments

Lucas De Marchi March 17, 2022, 7:35 p.m. UTC | #1
On Thu, Mar 17, 2022 at 08:36:13PM +0200, Jani Nikula wrote:
>intel_dmc_load_program() is only ever called when
>intel_dmc_has_payload() is true. Move the condition within
>intel_dmc_load_program() to let it be called directly.
>
>Also note that intel_dmc_has_payload() will always return false when
>HAS_DMC() is false. Remove the redundant check.
>
>Signed-off-by: Jani Nikula <jani.nikula@intel.com>


Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>

Lucas De Marchi

>---
> drivers/gpu/drm/i915/display/intel_display_power.c |  6 +++---
> drivers/gpu/drm/i915/display/intel_dmc.c           | 11 +----------
> 2 files changed, 4 insertions(+), 13 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
>index 3dc859032bac..b3efe345567f 100644
>--- a/drivers/gpu/drm/i915/display/intel_display_power.c
>+++ b/drivers/gpu/drm/i915/display/intel_display_power.c
>@@ -5387,7 +5387,7 @@ static void skl_display_core_init(struct drm_i915_private *dev_priv,
>
> 	gen9_dbuf_enable(dev_priv);
>
>-	if (resume && intel_dmc_has_payload(dev_priv))
>+	if (resume)
> 		intel_dmc_load_program(dev_priv);
> }
>
>@@ -5454,7 +5454,7 @@ static void bxt_display_core_init(struct drm_i915_private *dev_priv, bool resume
>
> 	gen9_dbuf_enable(dev_priv);
>
>-	if (resume && intel_dmc_has_payload(dev_priv))
>+	if (resume)
> 		intel_dmc_load_program(dev_priv);
> }
>
>@@ -5618,7 +5618,7 @@ static void icl_display_core_init(struct drm_i915_private *dev_priv,
> 	if (IS_DG2(dev_priv))
> 		intel_snps_phy_wait_for_calibration(dev_priv);
>
>-	if (resume && intel_dmc_has_payload(dev_priv))
>+	if (resume)
> 		intel_dmc_load_program(dev_priv);
>
> 	/* Wa_14011508470:tgl,dg1,rkl,adl-s,adl-p */
>diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c
>index a719c0f379ba..66fd69259e73 100644
>--- a/drivers/gpu/drm/i915/display/intel_dmc.c
>+++ b/drivers/gpu/drm/i915/display/intel_dmc.c
>@@ -276,17 +276,8 @@ void intel_dmc_load_program(struct drm_i915_private *dev_priv)
> 	struct intel_dmc *dmc = &dev_priv->dmc;
> 	u32 id, i;
>
>-	if (!HAS_DMC(dev_priv)) {
>-		drm_err(&dev_priv->drm,
>-			"No DMC support available for this platform\n");
>-		return;
>-	}
>-
>-	if (!dev_priv->dmc.dmc_info[DMC_FW_MAIN].payload) {
>-		drm_err(&dev_priv->drm,
>-			"Tried to program CSR with empty payload\n");
>+	if (!intel_dmc_has_payload(dev_priv))
> 		return;
>-	}
>
> 	assert_rpm_wakelock_held(&dev_priv->runtime_pm);
>
>-- 
>2.30.2
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
index 3dc859032bac..b3efe345567f 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power.c
+++ b/drivers/gpu/drm/i915/display/intel_display_power.c
@@ -5387,7 +5387,7 @@  static void skl_display_core_init(struct drm_i915_private *dev_priv,
 
 	gen9_dbuf_enable(dev_priv);
 
-	if (resume && intel_dmc_has_payload(dev_priv))
+	if (resume)
 		intel_dmc_load_program(dev_priv);
 }
 
@@ -5454,7 +5454,7 @@  static void bxt_display_core_init(struct drm_i915_private *dev_priv, bool resume
 
 	gen9_dbuf_enable(dev_priv);
 
-	if (resume && intel_dmc_has_payload(dev_priv))
+	if (resume)
 		intel_dmc_load_program(dev_priv);
 }
 
@@ -5618,7 +5618,7 @@  static void icl_display_core_init(struct drm_i915_private *dev_priv,
 	if (IS_DG2(dev_priv))
 		intel_snps_phy_wait_for_calibration(dev_priv);
 
-	if (resume && intel_dmc_has_payload(dev_priv))
+	if (resume)
 		intel_dmc_load_program(dev_priv);
 
 	/* Wa_14011508470:tgl,dg1,rkl,adl-s,adl-p */
diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c
index a719c0f379ba..66fd69259e73 100644
--- a/drivers/gpu/drm/i915/display/intel_dmc.c
+++ b/drivers/gpu/drm/i915/display/intel_dmc.c
@@ -276,17 +276,8 @@  void intel_dmc_load_program(struct drm_i915_private *dev_priv)
 	struct intel_dmc *dmc = &dev_priv->dmc;
 	u32 id, i;
 
-	if (!HAS_DMC(dev_priv)) {
-		drm_err(&dev_priv->drm,
-			"No DMC support available for this platform\n");
-		return;
-	}
-
-	if (!dev_priv->dmc.dmc_info[DMC_FW_MAIN].payload) {
-		drm_err(&dev_priv->drm,
-			"Tried to program CSR with empty payload\n");
+	if (!intel_dmc_has_payload(dev_priv))
 		return;
-	}
 
 	assert_rpm_wakelock_held(&dev_priv->runtime_pm);