[PATCH libdrm 1/2] xf86drm: inline drmIoctl()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As Chad [1] puts it:
> it's excessive to jump through the PLT into a shared object for a mere
> ioctl wrapper.

[1] https://lists.freedesktop.org/archives/mesa-dev/2017-June/159951.html

Signed-off-by: Eric Engestrom <eric@xxxxxxxxxxxx>
---
 xf86drm.c | 14 --------------
 xf86drm.h | 18 +++++++++++++++++-
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/xf86drm.c b/xf86drm.c
index 728ac78c..c82a76d2 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -179,20 +179,6 @@ void drmFree(void *pt)
     free(pt);
 }
 
-/**
- * Call ioctl, restarting if it is interupted
- */
-int
-drmIoctl(int fd, unsigned long request, void *arg)
-{
-    int ret;
-
-    do {
-        ret = ioctl(fd, request, arg);
-    } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
-    return ret;
-}
-
 static unsigned long drmGetKeyFromFd(int fd)
 {
     stat_t     st;
diff --git a/xf86drm.h b/xf86drm.h
index 74f54f17..aeed543f 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -38,6 +38,8 @@
 #include <sys/types.h>
 #include <stdint.h>
 #include <drm.h>
+#include <sys/ioctl.h>
+#include <errno.h>
 
 #if defined(__cplusplus)
 extern "C" {
@@ -118,7 +120,21 @@ typedef struct drmHashEntry {
     void     *tagTable;
 } drmHashEntry;
 
-extern int drmIoctl(int fd, unsigned long request, void *arg);
+/**
+ * Call ioctl, restarting if it is interupted
+ */
+static inline int
+drmIoctl(int fd, unsigned long request, void *arg)
+{
+    int ret;
+
+    do {
+        ret = ioctl(fd, request, arg);
+    } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
+
+    return ret;
+}
+
 extern void *drmGetHashTable(void);
 extern drmHashEntry *drmGetEntry(int fd);
 
-- 
Cheers,
  Eric

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux