From ebd6eb69f57b0f36a4bf9978b5c47ba4be86d261 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Tue, 4 Jul 2017 16:33:19 +0300 Subject: Make igtrc configuration common, with configurable suspend/resume delay This adds support for configurable suspend/resume delay and takes the occasion to move igtrc configuation from igt_chamelium to igt_core. This way, suspend/resume delay configuration can be used for all tests. Signed-off-by: Paul Kocialkowski Reviewed-by: Lyude Paul --- lib/igt_aux.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'lib/igt_aux.c') diff --git a/lib/igt_aux.c b/lib/igt_aux.c index 882dba06..86a213c2 100644 --- a/lib/igt_aux.c +++ b/lib/igt_aux.c @@ -748,10 +748,7 @@ static void suspend_via_rtcwake(enum igt_suspend_state state) igt_assert(state < SUSPEND_STATE_NUM); - if (autoresume_delay) - delay = autoresume_delay; - else - delay = state == SUSPEND_STATE_DISK ? 30 : 15; + delay = igt_get_autoresume_delay(state); /* * Skip if rtcwake would fail for a reason not related to the kernel's @@ -898,6 +895,28 @@ void igt_set_autoresume_delay(int delay_secs) autoresume_delay = delay_secs; } +/** + * igt_get_autoresume_delay: + * @state: an #igt_suspend_state, the target suspend state + * + * Retrieves how long we wait to resume the system after suspending it. + * This can either be set through igt_set_autoresume_delay or be a default + * value that depends on the suspend state. + * + * Returns: The autoresume delay, in seconds. + */ +int igt_get_autoresume_delay(enum igt_suspend_state state) +{ + int delay; + + if (autoresume_delay) + delay = autoresume_delay; + else + delay = state == SUSPEND_STATE_DISK ? 30 : 15; + + return delay; +} + /** * igt_drop_root: * -- cgit v1.2.3