[Intel-gfx] [PATCH 08/10] lib/igt_kms: Simplify return value of kmstest_get_connector_default_mode
Daniel Vetter
daniel.vetter at ffwll.ch
Tue Aug 12 12:12:03 CEST 2014
A plain bool is good enough, no need for fancy negative error values.
Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
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 76812a2dff12..9af0201abde7 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 0acfeba1e491..01bbf5f53b9b 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 f4197854b355..59e2434ccd50 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.0.1
More information about the Intel-gfx
mailing list