summaryrefslogtreecommitdiff
path: root/lib/igt_aux.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/igt_aux.c')
-rw-r--r--lib/igt_aux.c27
1 files changed, 23 insertions, 4 deletions
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
@@ -899,6 +896,28 @@ void igt_set_autoresume_delay(int 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:
*
* Drop root privileges and make sure it actually worked. Useful for tests