diff --git a/tests/gem_workarounds.c b/tests/gem_workarounds.c index c7286d86b7a0..c09512cb650d 100644 --- a/tests/gem_workarounds.c +++ b/tests/gem_workarounds.c @@ -45,11 +45,11 @@ struct intel_wa_reg { static struct intel_wa_reg *wa_regs; static int num_wa_regs; -static void wait_gpu(void) +static int open_and_wake_gpu(void) { int fd = drm_open_driver(DRIVER_INTEL); gem_quiescent_gpu(fd); - close(fd); + return fd; } static void test_hang_gpu(void) @@ -67,13 +67,13 @@ static void test_suspend_resume(void) static int workaround_fail_count(void) { - int i, fail_count = 0; + int i, fd, fail_count = 0; /* There is a small delay after coming ot of rc6 to the correct render context values will get loaded by hardware (bdw,chv). This here ensures that we have the correct context loaded before we start to read values */ - wait_gpu(); + fd = open_and_wake_gpu(); igt_debug("Address\tval\t\tmask\t\tread\t\tresult\n"); @@ -95,6 +95,8 @@ static int workaround_fail_count(void) } } + close(fd); + return fail_count; }