From 81dfcaba88f2a6f04830b7da2fd7d79cf6120a40 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Tue, 12 Aug 2014 11:56:41 +0200 Subject: [PATCH] lib/igt_kms: Simplify return value of kmstest_get_connector_default_mode A plain bool is good enough, no need for fancy negative error values. Signed-off-by: Daniel Vetter --- lib/igt_kms.c | 12 ++++++------ lib/igt_kms.h | 4 ++-- tests/kms_setmode.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 76812a2..9af0201 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -391,15 +391,15 @@ void kmstest_force_edid(int drm_fd, drmModeConnector *connector, igt_assert(ret != -1); } -int kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector, - drmModeModeInfo *mode) +bool kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector, + drmModeModeInfo *mode) { int i; if (!connector->count_modes) { fprintf(stderr, "no modes for connector %d\n", connector->connector_id); - return -1; + return false; } for (i = 0; i < connector->count_modes; i++) { @@ -411,7 +411,7 @@ int kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector, } } - return 0; + return true; } int kmstest_get_connector_config(int drm_fd, uint32_t connector_id, @@ -480,8 +480,8 @@ int kmstest_get_connector_config(int drm_fd, uint32_t connector_id, goto err3; found: - if (kmstest_get_connector_default_mode(drm_fd, connector, - &config->default_mode) < 0) + if (!kmstest_get_connector_default_mode(drm_fd, connector, + &config->default_mode)) goto err4; config->connector = connector; diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 0acfeba..01bbf5f 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -152,8 +152,8 @@ bool kmstest_force_connector(int fd, drmModeConnector *connector, void kmstest_force_edid(int drm_fd, drmModeConnector *connector, const unsigned char *edid, size_t length); -int kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector, - drmModeModeInfo *mode); +bool kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector, + drmModeModeInfo *mode); int kmstest_get_connector_config(int drm_fd, uint32_t connector_id, unsigned long crtc_idx_mask, struct kmstest_connector_config *config); diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c index f419785..59e2434 100644 --- a/tests/kms_setmode.c +++ b/tests/kms_setmode.c @@ -517,8 +517,8 @@ static int get_one_connector(drmModeRes *resources, int connector_id, } if (cconf->connected) { - if (kmstest_get_connector_default_mode(drm_fd, connector, - &mode) < 0) + if (!kmstest_get_connector_default_mode(drm_fd, connector, + &mode)) mode = mode_640_480; } else { mode = mode_640_480; -- 2.7.4