diff mbox series

[4/5] drm/i915: move lookup_power_well() up

Message ID 20180820233139.11936-4-paulo.r.zanoni@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/5] drm/i915: kill intel_display_power_well_is_enabled() | expand

Commit Message

Zanoni, Paulo R Aug. 20, 2018, 11:31 p.m. UTC
There's no need for that forward declaration.

Cc: Imre Deak <imre.deak@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/intel_runtime_pm.c | 46 +++++++++++++++------------------
 1 file changed, 21 insertions(+), 25 deletions(-)

Comments

Imre Deak Aug. 23, 2018, 1:44 p.m. UTC | #1
On Mon, Aug 20, 2018 at 04:31:38PM -0700, Paulo Zanoni wrote:
> There's no need for that forward declaration.
> 
> Cc: Imre Deak <imre.deak@intel.com>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

Reviewed-by: Imre Deak <imre.deak@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_runtime_pm.c | 46 +++++++++++++++------------------
>  1 file changed, 21 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
> index 6f5a2f00a12d..f38a049861e6 100644
> --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -49,10 +49,6 @@
>   * present for a given platform.
>   */
>  
> -static struct i915_power_well *
> -lookup_power_well(struct drm_i915_private *dev_priv,
> -		  enum i915_power_well_id power_well_id);
> -
>  const char *
>  intel_display_power_domain_str(enum intel_display_power_domain domain)
>  {
> @@ -649,6 +645,27 @@ static void assert_csr_loaded(struct drm_i915_private *dev_priv)
>  	WARN_ONCE(!I915_READ(CSR_HTP_SKL), "CSR HTP Not fine\n");
>  }
>  
> +static struct i915_power_well *
> +lookup_power_well(struct drm_i915_private *dev_priv,
> +		  enum i915_power_well_id power_well_id)
> +{
> +	struct i915_power_well *power_well;
> +
> +	for_each_power_well(dev_priv, power_well)
> +		if (power_well->desc->id == power_well_id)
> +			return power_well;
> +
> +	/*
> +	 * It's not feasible to add error checking code to the callers since
> +	 * this condition really shouldn't happen and it doesn't even make sense
> +	 * to abort things like display initialization sequences. Just return
> +	 * the first power well and hope the WARN gets reported so we can fix
> +	 * our driver.
> +	 */
> +	WARN(1, "Power well %d not defined for this platform\n", power_well_id);
> +	return &dev_priv->power_domains.power_wells[0];
> +}
> +
>  static void assert_can_enable_dc5(struct drm_i915_private *dev_priv)
>  {
>  	struct i915_power_well *pg2 = lookup_power_well(dev_priv,
> @@ -1081,27 +1098,6 @@ static void vlv_dpio_cmn_power_well_disable(struct drm_i915_private *dev_priv,
>  
>  #define POWER_DOMAIN_MASK (GENMASK_ULL(POWER_DOMAIN_NUM - 1, 0))
>  
> -static struct i915_power_well *
> -lookup_power_well(struct drm_i915_private *dev_priv,
> -		  enum i915_power_well_id power_well_id)
> -{
> -	struct i915_power_well *power_well;
> -
> -	for_each_power_well(dev_priv, power_well)
> -		if (power_well->desc->id == power_well_id)
> -			return power_well;
> -
> -	/*
> -	 * It's not feasible to add error checking code to the callers since
> -	 * this condition really shouldn't happen and it doesn't even make sense
> -	 * to abort things like display initialization sequences. Just return
> -	 * the first power well and hope the WARN gets reported so we can fix
> -	 * our driver.
> -	 */
> -	WARN(1, "Power well %d not defined for this platform\n", power_well_id);
> -	return &dev_priv->power_domains.power_wells[0];
> -}
> -
>  #define BITS_SET(val, bits) (((val) & (bits)) == (bits))
>  
>  static void assert_chv_phy_status(struct drm_i915_private *dev_priv)
> -- 
> 2.14.4
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
index 6f5a2f00a12d..f38a049861e6 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.c
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
@@ -49,10 +49,6 @@ 
  * present for a given platform.
  */
 
-static struct i915_power_well *
-lookup_power_well(struct drm_i915_private *dev_priv,
-		  enum i915_power_well_id power_well_id);
-
 const char *
 intel_display_power_domain_str(enum intel_display_power_domain domain)
 {
@@ -649,6 +645,27 @@  static void assert_csr_loaded(struct drm_i915_private *dev_priv)
 	WARN_ONCE(!I915_READ(CSR_HTP_SKL), "CSR HTP Not fine\n");
 }
 
+static struct i915_power_well *
+lookup_power_well(struct drm_i915_private *dev_priv,
+		  enum i915_power_well_id power_well_id)
+{
+	struct i915_power_well *power_well;
+
+	for_each_power_well(dev_priv, power_well)
+		if (power_well->desc->id == power_well_id)
+			return power_well;
+
+	/*
+	 * It's not feasible to add error checking code to the callers since
+	 * this condition really shouldn't happen and it doesn't even make sense
+	 * to abort things like display initialization sequences. Just return
+	 * the first power well and hope the WARN gets reported so we can fix
+	 * our driver.
+	 */
+	WARN(1, "Power well %d not defined for this platform\n", power_well_id);
+	return &dev_priv->power_domains.power_wells[0];
+}
+
 static void assert_can_enable_dc5(struct drm_i915_private *dev_priv)
 {
 	struct i915_power_well *pg2 = lookup_power_well(dev_priv,
@@ -1081,27 +1098,6 @@  static void vlv_dpio_cmn_power_well_disable(struct drm_i915_private *dev_priv,
 
 #define POWER_DOMAIN_MASK (GENMASK_ULL(POWER_DOMAIN_NUM - 1, 0))
 
-static struct i915_power_well *
-lookup_power_well(struct drm_i915_private *dev_priv,
-		  enum i915_power_well_id power_well_id)
-{
-	struct i915_power_well *power_well;
-
-	for_each_power_well(dev_priv, power_well)
-		if (power_well->desc->id == power_well_id)
-			return power_well;
-
-	/*
-	 * It's not feasible to add error checking code to the callers since
-	 * this condition really shouldn't happen and it doesn't even make sense
-	 * to abort things like display initialization sequences. Just return
-	 * the first power well and hope the WARN gets reported so we can fix
-	 * our driver.
-	 */
-	WARN(1, "Power well %d not defined for this platform\n", power_well_id);
-	return &dev_priv->power_domains.power_wells[0];
-}
-
 #define BITS_SET(val, bits) (((val) & (bits)) == (bits))
 
 static void assert_chv_phy_status(struct drm_i915_private *dev_priv)