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

drm/i915: remove device field from struct power_well

The only real need for this field was in
i915_{request,release}_power_well, but there we can get at it by a
container_of magic. Also since in the future we'll have multiple power
wells each with its own power_well struct it makes sense to remove the
field from there where it'd be just redundancy.
Suggested-by: default avatarPaulo Zanoni <paulo.zanoni@intel.com>
Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
Reviewed-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent baa70707
...@@ -909,7 +909,6 @@ struct intel_ilk_power_mgmt { ...@@ -909,7 +909,6 @@ struct intel_ilk_power_mgmt {
/* Power well structure for haswell */ /* Power well structure for haswell */
struct i915_power_well { struct i915_power_well {
struct drm_device *device;
/* power well enable/disable usage count */ /* power well enable/disable usage count */
int count; int count;
}; };
......
...@@ -5581,17 +5581,19 @@ static void __intel_set_power_well(struct drm_device *dev, bool enable) ...@@ -5581,17 +5581,19 @@ static void __intel_set_power_well(struct drm_device *dev, bool enable)
} }
} }
static void __intel_power_well_get(struct i915_power_well *power_well) static void __intel_power_well_get(struct drm_device *dev,
struct i915_power_well *power_well)
{ {
if (!power_well->count++) if (!power_well->count++)
__intel_set_power_well(power_well->device, true); __intel_set_power_well(dev, true);
} }
static void __intel_power_well_put(struct i915_power_well *power_well) static void __intel_power_well_put(struct drm_device *dev,
struct i915_power_well *power_well)
{ {
WARN_ON(!power_well->count); WARN_ON(!power_well->count);
if (!--power_well->count) if (!--power_well->count)
__intel_set_power_well(power_well->device, false); __intel_set_power_well(dev, false);
} }
void intel_display_power_get(struct drm_device *dev, void intel_display_power_get(struct drm_device *dev,
...@@ -5609,7 +5611,7 @@ void intel_display_power_get(struct drm_device *dev, ...@@ -5609,7 +5611,7 @@ void intel_display_power_get(struct drm_device *dev,
power_domains = &dev_priv->power_domains; power_domains = &dev_priv->power_domains;
mutex_lock(&power_domains->lock); mutex_lock(&power_domains->lock);
__intel_power_well_get(&power_domains->power_wells[0]); __intel_power_well_get(dev, &power_domains->power_wells[0]);
mutex_unlock(&power_domains->lock); mutex_unlock(&power_domains->lock);
} }
...@@ -5628,7 +5630,7 @@ void intel_display_power_put(struct drm_device *dev, ...@@ -5628,7 +5630,7 @@ void intel_display_power_put(struct drm_device *dev,
power_domains = &dev_priv->power_domains; power_domains = &dev_priv->power_domains;
mutex_lock(&power_domains->lock); mutex_lock(&power_domains->lock);
__intel_power_well_put(&power_domains->power_wells[0]); __intel_power_well_put(dev, &power_domains->power_wells[0]);
mutex_unlock(&power_domains->lock); mutex_unlock(&power_domains->lock);
} }
...@@ -5637,11 +5639,16 @@ static struct i915_power_domains *hsw_pwr; ...@@ -5637,11 +5639,16 @@ static struct i915_power_domains *hsw_pwr;
/* Display audio driver power well request */ /* Display audio driver power well request */
void i915_request_power_well(void) void i915_request_power_well(void)
{ {
struct drm_i915_private *dev_priv;
if (WARN_ON(!hsw_pwr)) if (WARN_ON(!hsw_pwr))
return; return;
dev_priv = container_of(hsw_pwr, struct drm_i915_private,
power_domains);
mutex_lock(&hsw_pwr->lock); mutex_lock(&hsw_pwr->lock);
__intel_power_well_get(&hsw_pwr->power_wells[0]); __intel_power_well_get(dev_priv->dev, &hsw_pwr->power_wells[0]);
mutex_unlock(&hsw_pwr->lock); mutex_unlock(&hsw_pwr->lock);
} }
EXPORT_SYMBOL_GPL(i915_request_power_well); EXPORT_SYMBOL_GPL(i915_request_power_well);
...@@ -5649,11 +5656,16 @@ EXPORT_SYMBOL_GPL(i915_request_power_well); ...@@ -5649,11 +5656,16 @@ EXPORT_SYMBOL_GPL(i915_request_power_well);
/* Display audio driver power well release */ /* Display audio driver power well release */
void i915_release_power_well(void) void i915_release_power_well(void)
{ {
struct drm_i915_private *dev_priv;
if (WARN_ON(!hsw_pwr)) if (WARN_ON(!hsw_pwr))
return; return;
dev_priv = container_of(hsw_pwr, struct drm_i915_private,
power_domains);
mutex_lock(&hsw_pwr->lock); mutex_lock(&hsw_pwr->lock);
__intel_power_well_put(&hsw_pwr->power_wells[0]); __intel_power_well_put(dev_priv->dev, &hsw_pwr->power_wells[0]);
mutex_unlock(&hsw_pwr->lock); mutex_unlock(&hsw_pwr->lock);
} }
EXPORT_SYMBOL_GPL(i915_release_power_well); EXPORT_SYMBOL_GPL(i915_release_power_well);
...@@ -5668,7 +5680,6 @@ int i915_init_power_well(struct drm_device *dev) ...@@ -5668,7 +5680,6 @@ int i915_init_power_well(struct drm_device *dev)
hsw_pwr = power_domains; hsw_pwr = power_domains;
power_well = &power_domains->power_wells[0]; power_well = &power_domains->power_wells[0];
power_well->device = dev;
power_well->count = 0; power_well->count = 0;
return 0; return 0;
......
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