Commit a45f4466 authored by Imre Deak's avatar Imre Deak Committed by Daniel Vetter

drm/i915: add noop power well handlers instead of NULL checking them

Reading code free of special cases wins over the small overhead of
calling a noop handler. Suggested by Jesse.
Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent c6cb582e
...@@ -5393,6 +5393,17 @@ static void hsw_power_well_disable(struct drm_i915_private *dev_priv, ...@@ -5393,6 +5393,17 @@ static void hsw_power_well_disable(struct drm_i915_private *dev_priv,
hsw_enable_package_c8(dev_priv); hsw_enable_package_c8(dev_priv);
} }
static void i9xx_always_on_power_well_noop(struct drm_i915_private *dev_priv,
struct i915_power_well *power_well)
{
}
static bool i9xx_always_on_power_well_enabled(struct drm_i915_private *dev_priv,
struct i915_power_well *power_well)
{
return true;
}
void intel_display_power_get(struct drm_i915_private *dev_priv, void intel_display_power_get(struct drm_i915_private *dev_priv,
enum intel_display_power_domain domain) enum intel_display_power_domain domain)
{ {
...@@ -5405,7 +5416,7 @@ void intel_display_power_get(struct drm_i915_private *dev_priv, ...@@ -5405,7 +5416,7 @@ void intel_display_power_get(struct drm_i915_private *dev_priv,
mutex_lock(&power_domains->lock); mutex_lock(&power_domains->lock);
for_each_power_well(i, power_well, BIT(domain), power_domains) for_each_power_well(i, power_well, BIT(domain), power_domains)
if (!power_well->count++ && power_well->ops->enable) if (!power_well->count++)
power_well->ops->enable(dev_priv, power_well); power_well->ops->enable(dev_priv, power_well);
power_domains->domain_use_count[domain]++; power_domains->domain_use_count[domain]++;
...@@ -5430,8 +5441,7 @@ void intel_display_power_put(struct drm_i915_private *dev_priv, ...@@ -5430,8 +5441,7 @@ void intel_display_power_put(struct drm_i915_private *dev_priv,
for_each_power_well_rev(i, power_well, BIT(domain), power_domains) { for_each_power_well_rev(i, power_well, BIT(domain), power_domains) {
WARN_ON(!power_well->count); WARN_ON(!power_well->count);
if (!--power_well->count && power_well->ops->disable && if (!--power_well->count && i915.disable_power_well)
i915.disable_power_well)
power_well->ops->disable(dev_priv, power_well); power_well->ops->disable(dev_priv, power_well);
} }
...@@ -5485,7 +5495,12 @@ EXPORT_SYMBOL_GPL(i915_release_power_well); ...@@ -5485,7 +5495,12 @@ EXPORT_SYMBOL_GPL(i915_release_power_well);
(POWER_DOMAIN_MASK & ~BDW_ALWAYS_ON_POWER_DOMAINS) | \ (POWER_DOMAIN_MASK & ~BDW_ALWAYS_ON_POWER_DOMAINS) | \
BIT(POWER_DOMAIN_INIT)) BIT(POWER_DOMAIN_INIT))
static const struct i915_power_well_ops i9xx_always_on_power_well_ops = { }; static const struct i915_power_well_ops i9xx_always_on_power_well_ops = {
.sync_hw = i9xx_always_on_power_well_noop,
.enable = i9xx_always_on_power_well_noop,
.disable = i9xx_always_on_power_well_noop,
.is_enabled = i9xx_always_on_power_well_enabled,
};
static struct i915_power_well i9xx_always_on_power_well[] = { static struct i915_power_well i9xx_always_on_power_well[] = {
{ {
...@@ -5571,10 +5586,8 @@ static void intel_power_domains_resume(struct drm_i915_private *dev_priv) ...@@ -5571,10 +5586,8 @@ static void intel_power_domains_resume(struct drm_i915_private *dev_priv)
int i; int i;
mutex_lock(&power_domains->lock); mutex_lock(&power_domains->lock);
for_each_power_well(i, power_well, POWER_DOMAIN_MASK, power_domains) { for_each_power_well(i, power_well, POWER_DOMAIN_MASK, power_domains)
if (power_well->ops->sync_hw)
power_well->ops->sync_hw(dev_priv, power_well); power_well->ops->sync_hw(dev_priv, power_well);
}
mutex_unlock(&power_domains->lock); mutex_unlock(&power_domains->lock);
} }
......
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