diff mbox series

[3/4] drm/i915: use for_each_power_well in lookup_power_well()

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

Commit Message

Zanoni, Paulo R Aug. 8, 2018, 10:16 p.m. UTC
Use the nice helper function to make the implementation simpler.

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 | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Comments

Souza, Jose Aug. 8, 2018, 10:50 p.m. UTC | #1
On Wed, 2018-08-08 at 15:16 -0700, Paulo Zanoni wrote:
> Use the nice helper function to make the implementation simpler.
> 

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>

> 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 | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c
> b/drivers/gpu/drm/i915/intel_runtime_pm.c
> index 2fdb1f4125c2..eabf98d153f7 100644
> --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -1109,16 +1109,11 @@ 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_domains *power_domains = &dev_priv-
> >power_domains;
> -	int i;
> -
> -	for (i = 0; i < power_domains->power_well_count; i++) {
> -		struct i915_power_well *power_well;
> +	struct i915_power_well *power_well;
>  
> -		power_well = &power_domains->power_wells[i];
> +	for_each_power_well(dev_priv, power_well)
>  		if (power_well->desc->id == power_well_id)
>  			return power_well;
> -	}
>  
>  	/* Tried to lookup a power well that doesn't exist for the
> platform. */
>  	BUG();
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 2fdb1f4125c2..eabf98d153f7 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.c
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
@@ -1109,16 +1109,11 @@  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_domains *power_domains = &dev_priv->power_domains;
-	int i;
-
-	for (i = 0; i < power_domains->power_well_count; i++) {
-		struct i915_power_well *power_well;
+	struct i915_power_well *power_well;
 
-		power_well = &power_domains->power_wells[i];
+	for_each_power_well(dev_priv, power_well)
 		if (power_well->desc->id == power_well_id)
 			return power_well;
-	}
 
 	/* Tried to lookup a power well that doesn't exist for the platform. */
 	BUG();