[PATCH xserver 04/15] dri3: simplify dri3_open() implementation

Emil Velikov emil.l.velikov at gmail.com
Mon Apr 2 15:41:15 UTC 2018


From: Emil Velikov <emil.velikov at collabora.com>

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 dri3/dri3_screen.c | 22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/dri3/dri3_screen.c b/dri3/dri3_screen.c
index f5e87bc9e..628f7616e 100644
--- a/dri3/dri3_screen.c
+++ b/dri3/dri3_screen.c
@@ -31,33 +31,21 @@
 #include <randrstr.h>
 #include <drm_fourcc.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
-- 
2.16.0



More information about the xorg-devel mailing list