summaryrefslogtreecommitdiff
path: root/lib/ioctl_wrappers.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-01-02 11:23:33 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2017-01-02 11:24:23 +0000
commit8f39310fa7484829f0899860b1677a0f75898edf (patch)
tree0f43fa939f255d831ab017c0f7ec7bbee5960d47 /lib/ioctl_wrappers.h
parent39858a1e752f8f26250171e8658388f0853c176c (diff)
lib: Wrap conversion from u64 to pointers
The opposite direction of to_user_pointer() is from_user_pointer(). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/ioctl_wrappers.h')
-rw-r--r--lib/ioctl_wrappers.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index f9507ad0..57ba5a29 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -250,4 +250,14 @@ static inline uint64_t to_user_pointer(const void *ptr)
return (uintptr_t)ptr;
}
+/**
+ * from_user_pointer:
+ *
+ * Casts a 64bit value from an ioctl into a pointer.
+ */
+static inline void *from_user_pointer(uint64_t u64)
+{
+ return (void *)(uintptr_t)u64;
+}
+
#endif /* IOCTL_WRAPPERS_H */