drm/i915: Balance assert_rpm_wakelock_held() for !IS_ENABLED(CONFIG_PM)

commit 0973128002
Author: Imre Deak <imre.deak@intel.com>
Date:   Wed Feb 17 14:17:42 2016 +0200

    drm/i915: Add helper to get a display power ref if it was already enabled

left the rpm wakelock assertions unbalanced if CONFIG_PM was disabled as
intel_runtime_pm_get_if_in_use() would return true without incrementing
the local bookkeeping required for the assertions.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
CC: Mika Kuoppala <mika.kuoppala@intel.com>
CC: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
CC: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1456434628-22574-1-git-send-email-chris@chris-wilson.co.uk
Reviewed-by: Imre Deak <imre.deak@intel.com>
This commit is contained in:
Chris Wilson 2016-02-25 21:10:28 +00:00 коммит произвёл Imre Deak
Родитель 99cf8ea165
Коммит 135dc79efb
1 изменённых файлов: 12 добавлений и 14 удалений

Просмотреть файл

@ -2365,22 +2365,20 @@ bool intel_runtime_pm_get_if_in_use(struct drm_i915_private *dev_priv)
{ {
struct drm_device *dev = dev_priv->dev; struct drm_device *dev = dev_priv->dev;
struct device *device = &dev->pdev->dev; struct device *device = &dev->pdev->dev;
int ret;
if (!IS_ENABLED(CONFIG_PM)) if (IS_ENABLED(CONFIG_PM)) {
return true; int ret = pm_runtime_get_if_in_use(device);
ret = pm_runtime_get_if_in_use(device);
/* /*
* In cases runtime PM is disabled by the RPM core and we get an * In cases runtime PM is disabled by the RPM core and we get
* -EINVAL return value we are not supposed to call this function, * an -EINVAL return value we are not supposed to call this
* since the power state is undefined. This applies atm to the * function, since the power state is undefined. This applies
* late/early system suspend/resume handlers. * atm to the late/early system suspend/resume handlers.
*/ */
WARN_ON_ONCE(ret < 0); WARN_ON_ONCE(ret < 0);
if (ret <= 0) if (ret <= 0)
return false; return false;
}
atomic_inc(&dev_priv->pm.wakeref_count); atomic_inc(&dev_priv->pm.wakeref_count);
assert_rpm_wakelock_held(dev_priv); assert_rpm_wakelock_held(dev_priv);