From bacaebb73638385f1c8c5526e12a7e30de93d91d Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Wed, 30 Mar 2016 17:12:33 +0200 Subject: [PATCH 1/2] drm: Make drm.h uapi header safe for C++ virtual is a protected keyword in C++ and can't be used at all. Ugh. This aligns the kernel versions of the drm headers with the ones in libdrm. v2: Also annote with __user, as request by Emil&Ilia. CRs-Fixed: 2038080 Change-Id: I184b99e51fc5c6efd4eb6f5ed9da2858b7972a6e Cc: Ilia Mirkin Cc: Emil Velikov Reviewed-by: Emil Velikov Signed-off-by: Daniel Vetter Link: http://patchwork.freedesktop.org/patch/msgid/1459350753-18320-1-git-send-email-daniel.vetter@ffwll.ch Git-commit: 4c4925fa0c2b5943655ef28b2d6a379961db551f Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4c4925f Signed-off-by: Manoj Kumar AVM --- include/uapi/drm/drm.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 3801584a0c53..68927d7601b6 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -372,7 +372,11 @@ struct drm_buf_pub { */ struct drm_buf_map { int count; /**< Length of the buffer list */ +#ifdef __cplusplus + void __user *virt; +#else void __user *virtual; /**< Mmap'd area in user-virtual */ +#endif struct drm_buf_pub __user *list; /**< Buffer information */ }; From ccbadce56cf483750dc73a6d540d888425e679bc Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 7 Apr 2016 18:49:00 +0100 Subject: [PATCH 2/2] drm: add extern C guard for the UAPI headers CRs-Fixed: 2038080 Change-Id: Id6f4ac3d41fec4804b1449f303d4872bf7a1fd51 Signed-off-by: Emil Velikov Git-commit: ebbb0e5cfd2ceb1150b1af7f9fcf7aeebfb1b69f Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ebbb0e5cf Signed-off-by: Manoj Kumar AVM --- include/uapi/drm/drm.h | 18 +++++++++++++++++- include/uapi/drm/drm_fourcc.h | 8 ++++++++ include/uapi/drm/drm_mode.h | 8 ++++++++ include/uapi/drm/drm_sarea.h | 8 ++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 68927d7601b6..24c76d138317 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -58,6 +58,10 @@ typedef unsigned long drm_handle_t; #endif +#if defined(__cplusplus) +extern "C" { +#endif + #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ #define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */ @@ -683,7 +687,15 @@ struct drm_prime_handle { __s32 fd; }; -#include +#if defined(__cplusplus) +} +#endif + +#include "drm_mode.h" + +#if defined(__cplusplus) +extern "C" { +#endif #define DRM_IOCTL_BASE 'd' #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) @@ -878,4 +890,8 @@ typedef struct drm_scatter_gather drm_scatter_gather_t; typedef struct drm_set_version drm_set_version_t; #endif +#if defined(__cplusplus) +} +#endif + #endif diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index 53d7c80f5eb0..7f203a5f83cb 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -26,6 +26,10 @@ #include +#if defined(__cplusplus) +extern "C" { +#endif + #define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \ ((__u32)(c) << 16) | ((__u32)(d) << 24)) @@ -237,4 +241,8 @@ */ #define DRM_FORMAT_MOD_QCOM_COMPRESSED fourcc_mod_code(QCOM, 1) +#if defined(__cplusplus) +} +#endif + #endif /* DRM_FOURCC_H */ diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 1c5e74f1ea39..0630e0f64b9c 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h @@ -29,6 +29,10 @@ #include +#if defined(__cplusplus) +extern "C" { +#endif + #define DRM_DISPLAY_INFO_LEN 32 #define DRM_CONNECTOR_NAME_LEN 32 #define DRM_DISPLAY_MODE_LEN 32 @@ -599,4 +603,8 @@ struct drm_mode_destroy_blob { __u32 blob_id; }; +#if defined(__cplusplus) +} +#endif + #endif diff --git a/include/uapi/drm/drm_sarea.h b/include/uapi/drm/drm_sarea.h index 413a5642d49f..12285bc929a1 100644 --- a/include/uapi/drm/drm_sarea.h +++ b/include/uapi/drm/drm_sarea.h @@ -34,6 +34,10 @@ #include +#if defined(__cplusplus) +extern "C" { +#endif + /* SAREA area needs to be at least a page */ #if defined(__alpha__) #define SAREA_MAX 0x2000U @@ -83,4 +87,8 @@ typedef struct drm_sarea_frame drm_sarea_frame_t; typedef struct drm_sarea drm_sarea_t; #endif +#if defined(__cplusplus) +} +#endif + #endif /* _DRM_SAREA_H_ */