Add to_user_pointer() helper function which helps cast pointers properly when being used with ioctls. Signed-off-by: Robert Foss <robert.foss@xxxxxxxxxxxxx> --- lib/ioctl_wrappers.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h index 26270975..2ac57f47 100644 --- a/lib/ioctl_wrappers.h +++ b/lib/ioctl_wrappers.h @@ -239,4 +239,15 @@ int __kms_addfb(int fd, uint32_t handle, uint32_t width, uint32_t height, uint32_t stride, uint32_t pixel_format, uint64_t modifier, uint32_t flags, uint32_t *buf_id); +/** + * to_user_pointer: + * + * Makes sure that pointer on 32 and 64-bit systems + * are casted properly for being sent through an ioctl. + */ +inline uint64_t to_user_pointer(void *ptr) +{ + return (uint64_t)(uintptr_t) ptr; +} + #endif /* IOCTL_WRAPPERS_H */ -- 2.11.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx