summaryrefslogtreecommitdiff
path: root/dri3
diff options
context:
space:
mode:
authorEmil Velikov <emil.velikov@collabora.com>2018-04-02 16:41:15 +0100
committerAdam Jackson <ajax@redhat.com>2018-04-10 15:42:40 -0400
commita83ceec868a6d544bc7775a753b67aa40d0d0efc (patch)
treee8f21385cb1820ef301cb89fae6467fbd2905433 /dri3
parent9a159f37e00ed47ec8cbff7c57d8787b8f5685f5 (diff)
dri3: simplify dri3_open() implementation
Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Diffstat (limited to 'dri3')
-rw-r--r--dri3/dri3_screen.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/dri3/dri3_screen.c b/dri3/dri3_screen.c
index 58f5ff71d..1257c0ef4 100644
--- a/dri3/dri3_screen.c
+++ b/dri3/dri3_screen.c
@@ -32,33 +32,21 @@
#include <drm_fourcc.h>
#include <unistd.h>
-static inline Bool has_open(const dri3_screen_info_rec *info) {
- if (info == NULL)
- return FALSE;
-
- return info->open != NULL ||
- (info->version >= 1 && info->open_client != NULL);
-}
-
int
dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd)
{
dri3_screen_priv_ptr ds = dri3_screen_priv(screen);
const dri3_screen_info_rec *info = ds->info;
- int rc;
- if (!has_open(info))
+ if (info == NULL)
return BadMatch;
if (info->version >= 1 && info->open_client != NULL)
- rc = (*info->open_client) (client, screen, provider, fd);
- else
- rc = (*info->open) (screen, provider, fd);
-
- if (rc != Success)
- return rc;
+ return (*info->open_client) (client, screen, provider, fd);
+ if (info->open != NULL)
+ return (*info->open) (screen, provider, fd);
- return Success;
+ return BadMatch;
}
int