diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2019-01-14 14:21:23 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2019-01-14 16:18:25 +0000 |
commit | d4225a535b3b086868ce1f82dc0593d85d04dae8 (patch) | |
tree | 2eb43e414d4c87afe3768f5e1d8e0452314ea5ff /drivers/gpu/drm/i915/selftests/i915_gem_evict.c | |
parent | c9d08cc3e3393e19162cb2cfaa1f454baf2aaffe (diff) | |
download | linux-d4225a535b3b086868ce1f82dc0593d85d04dae8.tar.bz2 |
drm/i915: Syntatic sugar for using intel_runtime_pm
Frequently, we use intel_runtime_pm_get/_put around a small block.
Formalise that usage by providing a macro to define such a block with an
automatic closure to scope the intel_runtime_pm wakeref to that block,
i.e. macro abuse smelling of python.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190114142129.24398-15-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/selftests/i915_gem_evict.c')
-rw-r--r-- | drivers/gpu/drm/i915/selftests/i915_gem_evict.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c index bbcbf11c72b3..067e5dfa0a24 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c @@ -484,18 +484,16 @@ int i915_gem_evict_mock_selftests(void) }; struct drm_i915_private *i915; intel_wakeref_t wakeref; - int err; + int err = 0; i915 = mock_gem_device(); if (!i915) return -ENOMEM; mutex_lock(&i915->drm.struct_mutex); - wakeref = intel_runtime_pm_get(i915); + with_intel_runtime_pm(i915, wakeref) + err = i915_subtests(tests, i915); - err = i915_subtests(tests, i915); - - intel_runtime_pm_put(i915, wakeref); mutex_unlock(&i915->drm.struct_mutex); drm_dev_put(&i915->drm); |