diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-09-03 12:22:09 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-09-03 15:19:30 +0200 |
commit | f4b93781be0032b4d99097d71b305638c8eb03e2 (patch) | |
tree | aebabc106c37b2b38bdddcda3cd5fd4457f62b44 | |
parent | e45b7d9474da7b771f941d4729a435b49ef8529d (diff) |
lib/drmtest: use igt_require/assert in the prefault helpers
-rw-r--r-- | lib/drmtest.c | 22 | ||||
-rw-r--r-- | lib/drmtest.h | 4 |
2 files changed, 8 insertions, 18 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c index 5475a4d3..37a0e221 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -1956,7 +1956,7 @@ void kmstest_free_connector_config(struct kmstest_connector_config *config) } #define PREFAULT_DEBUGFS "/sys/module/i915/parameters/prefault_disable" -static int igt_prefault_control(bool enable) +static void igt_prefault_control(bool enable) { const char *name = PREFAULT_DEBUGFS; int fd; @@ -1965,26 +1965,16 @@ static int igt_prefault_control(bool enable) int result = 0; fd = open(name, O_RDWR); - if (fd == -1) { - fprintf(stderr, "Couldn't open prefault_debugfs.%s\n", - strerror(errno)); - return -1; - } + igt_require(fd >= 0); if (enable) index = 1; else index = 0; - if (write(fd, &buf[index], 1) != 1) { - fprintf(stderr, "write prefault_debugfs error.%s\n", - strerror(errno)); - result = -1; - } + igt_assert(write(fd, &buf[index], 1) == 1); close(fd); - - return result; } static void enable_prefault_at_exit(int sig) @@ -1992,14 +1982,14 @@ static void enable_prefault_at_exit(int sig) igt_enable_prefault(); } -int igt_disable_prefault(void) +void igt_disable_prefault(void) { igt_install_exit_handler(enable_prefault_at_exit); - return igt_prefault_control(false); + igt_prefault_control(false); } -int igt_enable_prefault(void) +void igt_enable_prefault(void) { return igt_prefault_control(true); } diff --git a/lib/drmtest.h b/lib/drmtest.h index 3d1c323c..663e309a 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -341,8 +341,8 @@ void igt_disable_exit_handler(void); int igt_set_vt_graphics_mode(void); /* prefault disabling, needs the corresponding debugfs interface */ -int igt_disable_prefault(void); -int igt_enable_prefault(void); +void igt_disable_prefault(void); +void igt_enable_prefault(void); /* suspend and auto-resume system */ void igt_system_suspend_autoresume(void); |