From patchwork Fri Oct 25 14:36:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 3096201 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4A761BF924 for ; Fri, 25 Oct 2013 15:51:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4576E20176 for ; Fri, 25 Oct 2013 15:51:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0D2EB20174 for ; Fri, 25 Oct 2013 15:51:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 03246E6E57 for ; Fri, 25 Oct 2013 08:51:32 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 11FE3E6CBB for ; Fri, 25 Oct 2013 07:36:59 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 25 Oct 2013 07:33:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,570,1378882800"; d="scan'208";a="417175044" Received: from intelbox.fi.intel.com (HELO localhost) ([10.237.72.105]) by fmsmga001.fm.intel.com with ESMTP; 25 Oct 2013 07:36:57 -0700 From: Imre Deak To: intel-gfx@lists.freedesktop.org Date: Fri, 25 Oct 2013 17:36:49 +0300 Message-Id: <1382711810-25881-4-git-send-email-imre.deak@intel.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1382711810-25881-1-git-send-email-imre.deak@intel.com> References: <1382711810-25881-1-git-send-email-imre.deak@intel.com> In-Reply-To: <1382464076-5030-1-git-send-email-imre.deak@intel.com> References: <1382464076-5030-1-git-send-email-imre.deak@intel.com> Subject: [Intel-gfx] [PATCH v3 3/4] drm/i915: remove device field from struct power_well X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: Paulo Zanoni Signed-off-by: Imre Deak Reviewed-by: Paulo Zanoni --- drivers/gpu/drm/i915/i915_drv.h | 1 - drivers/gpu/drm/i915/intel_pm.c | 29 ++++++++++++++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 3565db2..2731fbb 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -911,7 +911,6 @@ struct intel_ilk_power_mgmt { /* Power well structure for haswell */ struct i915_power_well { - struct drm_device *device; /* power well enable/disable usage count */ int count; }; diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 4c38e28..4f84a4b 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5608,17 +5608,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++) - __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); 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, @@ -5636,7 +5638,7 @@ void intel_display_power_get(struct drm_device *dev, power_domains = &dev_priv->power_domains; 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); } @@ -5655,7 +5657,7 @@ void intel_display_power_put(struct drm_device *dev, power_domains = &dev_priv->power_domains; 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); } @@ -5664,11 +5666,16 @@ static struct i915_power_domains *hsw_pwr; /* Display audio driver power well request */ void i915_request_power_well(void) { + struct drm_i915_private *dev_priv; + if (WARN_ON(!hsw_pwr)) return; + dev_priv = container_of(hsw_pwr, struct drm_i915_private, + power_domains); + 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); } EXPORT_SYMBOL_GPL(i915_request_power_well); @@ -5676,11 +5683,16 @@ EXPORT_SYMBOL_GPL(i915_request_power_well); /* Display audio driver power well release */ void i915_release_power_well(void) { + struct drm_i915_private *dev_priv; + if (WARN_ON(!hsw_pwr)) return; + dev_priv = container_of(hsw_pwr, struct drm_i915_private, + power_domains); + 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); } EXPORT_SYMBOL_GPL(i915_release_power_well); @@ -5695,7 +5707,6 @@ int i915_init_power_well(struct drm_device *dev) hsw_pwr = power_domains; power_well = &power_domains->power_wells[0]; - power_well->device = dev; power_well->count = 0; return 0;