aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/selftests/i915_request.c
diff options
context:
space:
mode:
authorChris Wilson <[email protected]>2019-01-14 14:21:23 +0000
committerChris Wilson <[email protected]>2019-01-14 16:18:25 +0000
commitd4225a535b3b086868ce1f82dc0593d85d04dae8 (patch)
tree2eb43e414d4c87afe3768f5e1d8e0452314ea5ff /drivers/gpu/drm/i915/selftests/i915_request.c
parentc9d08cc3e3393e19162cb2cfaa1f454baf2aaffe (diff)
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 <[email protected]> Cc: Jani Nikula <[email protected]> Reviewed-by: Mika Kuoppala <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Diffstat (limited to 'drivers/gpu/drm/i915/selftests/i915_request.c')
-rw-r--r--drivers/gpu/drm/i915/selftests/i915_request.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
index 9f705ff9423f..2e14d6d3bad7 100644
--- a/drivers/gpu/drm/i915/selftests/i915_request.c
+++ b/drivers/gpu/drm/i915/selftests/i915_request.c
@@ -256,17 +256,15 @@ int i915_request_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;
- 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);
drm_dev_put(&i915->drm);
return err;