Commit 0229bfd4 authored by Paulo Zanoni's avatar Paulo Zanoni

drm/i915: use for_each_power_well in lookup_power_well()

Use the nice helper function to make the implementation simpler.

v2: Rebase.

Cc: Imre Deak <imre.deak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com> (v1)
Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180820233139.11936-3-paulo.r.zanoni@intel.com
parent 99da0b35
...@@ -1087,16 +1087,11 @@ static struct i915_power_well * ...@@ -1087,16 +1087,11 @@ static struct i915_power_well *
lookup_power_well(struct drm_i915_private *dev_priv, lookup_power_well(struct drm_i915_private *dev_priv,
enum i915_power_well_id power_well_id) 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) if (power_well->desc->id == power_well_id)
return power_well; return power_well;
}
/* /*
* It's not feasible to add error checking code to the callers since * It's not feasible to add error checking code to the callers since
...@@ -1106,7 +1101,7 @@ lookup_power_well(struct drm_i915_private *dev_priv, ...@@ -1106,7 +1101,7 @@ lookup_power_well(struct drm_i915_private *dev_priv,
* our driver. * our driver.
*/ */
WARN(1, "Power well %d not defined for this platform\n", power_well_id); WARN(1, "Power well %d not defined for this platform\n", power_well_id);
return &power_domains->power_wells[0]; return &dev_priv->power_domains.power_wells[0];
} }
#define BITS_SET(val, bits) (((val) & (bits)) == (bits)) #define BITS_SET(val, bits) (((val) & (bits)) == (bits))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment