diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2018-09-05 10:03:39 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-09-05 16:41:05 +0100 |
commit | 7d2ab5b90b48fe50435ee8f43ed130ea323be951 (patch) | |
tree | bacd8ca7aa0cc687e808c7a3abc6a61ed41913b8 /lib/igt_pm.c | |
parent | c3b6d69aa3dd2d1a6c1f2e787670a0aef78f2ea5 (diff) |
lib/pm: Fail gracefully if CONFIG_PM is not built into the kernel
We report the failure from igt_setup_runtime_pm() so that the caller can
decide how they may proceed, so replace the hard assert with the error
propagation.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'lib/igt_pm.c')
-rw-r--r-- | lib/igt_pm.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/igt_pm.c b/lib/igt_pm.c index 615463a0..49027238 100644 --- a/lib/igt_pm.c +++ b/lib/igt_pm.c @@ -511,12 +511,16 @@ bool igt_setup_runtime_pm(void) igt_pm_enable_audio_runtime_pm(); - /* Our implementation uses autosuspend. Try to set it to 0ms so the test - * suite goes faster and we have a higher probability of triggering race - * conditions. */ + /* + * Our implementation uses autosuspend. Try to set it to 0ms so the + * test suite goes faster and we have a higher probability of + * triggering race conditions. + */ fd = open(POWER_DIR "/autosuspend_delay_ms", O_RDWR); - igt_assert_f(fd >= 0, - "Can't open " POWER_DIR "/autosuspend_delay_ms\n"); + if (fd < 0) { + igt_pm_audio_restore_runtime_pm(); + return false; + } /* * Save previous values to be able to install exit handler to restore @@ -531,6 +535,7 @@ bool igt_setup_runtime_pm(void) */ if (size <= 0) { close(fd); + igt_pm_audio_restore_runtime_pm(); return false; } |