[PATCH 59/74] drm: Fix type definition for drm_compat_ioctl_t

Chris Wilson chris at chris-wilson.co.uk
Thu Sep 14 17:34:33 UTC 2017


Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/drm_ioc32.c       | 112 +++++++++++++++++++-------------------
 drivers/gpu/drm/i915/i915_ioc32.c |   4 +-
 drivers/gpu/drm/mga/mga_ioc32.c   |  12 ++--
 drivers/gpu/drm/r128/r128_ioc32.c |  16 +++---
 include/drm/drm_ioctl.h           |   5 +-
 5 files changed, 75 insertions(+), 74 deletions(-)

diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c
index f8e96e648acf..ce830999cda4 100644
--- a/drivers/gpu/drm/drm_ioc32.c
+++ b/drivers/gpu/drm/drm_ioc32.c
@@ -86,8 +86,8 @@ typedef struct drm_version_32 {
 	u32 desc;		  /* User-space buffer to hold desc */
 } drm_version32_t;
 
-static int compat_drm_version(struct file *file, unsigned int cmd,
-			      unsigned long arg)
+static long compat_drm_version(struct file *file, unsigned int cmd,
+			       unsigned long arg)
 {
 	drm_version32_t v32;
 	struct drm_version v;
@@ -125,8 +125,8 @@ typedef struct drm_unique32 {
 	u32 unique;	/* Unique name for driver instantiation */
 } drm_unique32_t;
 
-static int compat_drm_getunique(struct file *file, unsigned int cmd,
-				unsigned long arg)
+static long compat_drm_getunique(struct file *file, unsigned int cmd,
+				 unsigned long arg)
 {
 	drm_unique32_t uq32;
 	struct drm_unique uq;
@@ -149,8 +149,8 @@ static int compat_drm_getunique(struct file *file, unsigned int cmd,
 	return 0;
 }
 
-static int compat_drm_setunique(struct file *file, unsigned int cmd,
-				unsigned long arg)
+static long compat_drm_setunique(struct file *file, unsigned int cmd,
+				 unsigned long arg)
 {
 	/* it's dead */
 	return -EINVAL;
@@ -165,8 +165,8 @@ typedef struct drm_map32 {
 	int mtrr;		/* MTRR slot used */
 } drm_map32_t;
 
-static int compat_drm_getmap(struct file *file, unsigned int cmd,
-			     unsigned long arg)
+static long compat_drm_getmap(struct file *file, unsigned int cmd,
+			      unsigned long arg)
 {
 	drm_map32_t __user *argp = (void __user *)arg;
 	drm_map32_t m32;
@@ -193,8 +193,8 @@ static int compat_drm_getmap(struct file *file, unsigned int cmd,
 
 }
 
-static int compat_drm_addmap(struct file *file, unsigned int cmd,
-			     unsigned long arg)
+static long compat_drm_addmap(struct file *file, unsigned int cmd,
+			      unsigned long arg)
 {
 	drm_map32_t __user *argp = (void __user *)arg;
 	drm_map32_t m32;
@@ -227,8 +227,8 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd,
 	return 0;
 }
 
-static int compat_drm_rmmap(struct file *file, unsigned int cmd,
-			    unsigned long arg)
+static long compat_drm_rmmap(struct file *file, unsigned int cmd,
+			     unsigned long arg)
 {
 	drm_map32_t __user *argp = (void __user *)arg;
 	struct drm_map map;
@@ -249,8 +249,8 @@ typedef struct drm_client32 {
 	u32 iocs;	/* Ioctl count */
 } drm_client32_t;
 
-static int compat_drm_getclient(struct file *file, unsigned int cmd,
-				unsigned long arg)
+static long compat_drm_getclient(struct file *file, unsigned int cmd,
+				 unsigned long arg)
 {
 	drm_client32_t c32;
 	drm_client32_t __user *argp = (void __user *)arg;
@@ -286,8 +286,8 @@ typedef struct drm_stats32 {
 	} data[15];
 } drm_stats32_t;
 
-static int compat_drm_getstats(struct file *file, unsigned int cmd,
-			       unsigned long arg)
+static long compat_drm_getstats(struct file *file, unsigned int cmd,
+				unsigned long arg)
 {
 	drm_stats32_t __user *argp = (void __user *)arg;
 	int err;
@@ -310,8 +310,8 @@ typedef struct drm_buf_desc32 {
 	u32 agp_start;		 /* Start address in the AGP aperture */
 } drm_buf_desc32_t;
 
-static int compat_drm_addbufs(struct file *file, unsigned int cmd,
-			      unsigned long arg)
+static long compat_drm_addbufs(struct file *file, unsigned int cmd,
+			       unsigned long arg)
 {
 	drm_buf_desc32_t __user *argp = (void __user *)arg;
 	drm_buf_desc32_t desc32;
@@ -341,8 +341,8 @@ static int compat_drm_addbufs(struct file *file, unsigned int cmd,
 	return 0;
 }
 
-static int compat_drm_markbufs(struct file *file, unsigned int cmd,
-			       unsigned long arg)
+static long compat_drm_markbufs(struct file *file, unsigned int cmd,
+				unsigned long arg)
 {
 	drm_buf_desc32_t b32;
 	drm_buf_desc32_t __user *argp = (void __user *)arg;
@@ -382,8 +382,8 @@ static int drm_legacy_infobufs32(struct drm_device *dev, void *data,
 	return __drm_legacy_infobufs(dev, data, &request->count, copy_one_buf32);
 }
 
-static int compat_drm_infobufs(struct file *file, unsigned int cmd,
-			       unsigned long arg)
+static long compat_drm_infobufs(struct file *file, unsigned int cmd,
+				unsigned long arg)
 {
 	drm_buf_info32_t req32;
 	drm_buf_info32_t __user *argp = (void __user *)arg;
@@ -446,8 +446,8 @@ static int drm_legacy_mapbufs32(struct drm_device *dev, void *data,
 	return err;
 }
 
-static int compat_drm_mapbufs(struct file *file, unsigned int cmd,
-			      unsigned long arg)
+static long compat_drm_mapbufs(struct file *file, unsigned int cmd,
+			       unsigned long arg)
 {
 	drm_buf_map32_t __user *argp = (void __user *)arg;
 	drm_buf_map32_t req32;
@@ -474,8 +474,8 @@ typedef struct drm_buf_free32 {
 	u32 list;
 } drm_buf_free32_t;
 
-static int compat_drm_freebufs(struct file *file, unsigned int cmd,
-			       unsigned long arg)
+static long compat_drm_freebufs(struct file *file, unsigned int cmd,
+				unsigned long arg)
 {
 	drm_buf_free32_t req32;
 	struct drm_buf_free request;
@@ -494,8 +494,8 @@ typedef struct drm_ctx_priv_map32 {
 	u32 handle;		/**< Handle of map */
 } drm_ctx_priv_map32_t;
 
-static int compat_drm_setsareactx(struct file *file, unsigned int cmd,
-				  unsigned long arg)
+static long compat_drm_setsareactx(struct file *file, unsigned int cmd,
+				   unsigned long arg)
 {
 	drm_ctx_priv_map32_t req32;
 	struct drm_ctx_priv_map request;
@@ -510,8 +510,8 @@ static int compat_drm_setsareactx(struct file *file, unsigned int cmd,
 				DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY);
 }
 
-static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
-				  unsigned long arg)
+static long compat_drm_getsareactx(struct file *file, unsigned int cmd,
+				   unsigned long arg)
 {
 	struct drm_ctx_priv_map req;
 	drm_ctx_priv_map32_t req32;
@@ -538,8 +538,8 @@ typedef struct drm_ctx_res32 {
 	u32 contexts;
 } drm_ctx_res32_t;
 
-static int compat_drm_resctx(struct file *file, unsigned int cmd,
-			     unsigned long arg)
+static long compat_drm_resctx(struct file *file, unsigned int cmd,
+			      unsigned long arg)
 {
 	drm_ctx_res32_t __user *argp = (void __user *)arg;
 	drm_ctx_res32_t res32;
@@ -575,8 +575,8 @@ typedef struct drm_dma32 {
 	int granted_count;	  /**< Number of buffers granted */
 } drm_dma32_t;
 
-static int compat_drm_dma(struct file *file, unsigned int cmd,
-			  unsigned long arg)
+static long compat_drm_dma(struct file *file, unsigned int cmd,
+			   unsigned long arg)
 {
 	drm_dma32_t d32;
 	drm_dma32_t __user *argp = (void __user *)arg;
@@ -610,8 +610,8 @@ typedef struct drm_agp_mode32 {
 	u32 mode;	/**< AGP mode */
 } drm_agp_mode32_t;
 
-static int compat_drm_agp_enable(struct file *file, unsigned int cmd,
-				 unsigned long arg)
+static long compat_drm_agp_enable(struct file *file, unsigned int cmd,
+				  unsigned long arg)
 {
 	drm_agp_mode32_t __user *argp = (void __user *)arg;
 	struct drm_agp_mode mode;
@@ -637,8 +637,8 @@ typedef struct drm_agp_info32 {
 	unsigned short id_device;
 } drm_agp_info32_t;
 
-static int compat_drm_agp_info(struct file *file, unsigned int cmd,
-			       unsigned long arg)
+static long compat_drm_agp_info(struct file *file, unsigned int cmd,
+				unsigned long arg)
 {
 	drm_agp_info32_t __user *argp = (void __user *)arg;
 	drm_agp_info32_t i32;
@@ -671,8 +671,8 @@ typedef struct drm_agp_buffer32 {
 	u32 physical;	/**< Physical used by i810 */
 } drm_agp_buffer32_t;
 
-static int compat_drm_agp_alloc(struct file *file, unsigned int cmd,
-				unsigned long arg)
+static long compat_drm_agp_alloc(struct file *file, unsigned int cmd,
+				 unsigned long arg)
 {
 	drm_agp_buffer32_t __user *argp = (void __user *)arg;
 	drm_agp_buffer32_t req32;
@@ -700,8 +700,8 @@ static int compat_drm_agp_alloc(struct file *file, unsigned int cmd,
 	return 0;
 }
 
-static int compat_drm_agp_free(struct file *file, unsigned int cmd,
-			       unsigned long arg)
+static long compat_drm_agp_free(struct file *file, unsigned int cmd,
+				unsigned long arg)
 {
 	drm_agp_buffer32_t __user *argp = (void __user *)arg;
 	struct drm_agp_buffer request;
@@ -718,8 +718,8 @@ typedef struct drm_agp_binding32 {
 	u32 offset;	/**< In bytes -- will round to page boundary */
 } drm_agp_binding32_t;
 
-static int compat_drm_agp_bind(struct file *file, unsigned int cmd,
-			       unsigned long arg)
+static long compat_drm_agp_bind(struct file *file, unsigned int cmd,
+				unsigned long arg)
 {
 	drm_agp_binding32_t __user *argp = (void __user *)arg;
 	drm_agp_binding32_t req32;
@@ -734,8 +734,8 @@ static int compat_drm_agp_bind(struct file *file, unsigned int cmd,
 				DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY);
 }
 
-static int compat_drm_agp_unbind(struct file *file, unsigned int cmd,
-				 unsigned long arg)
+static long compat_drm_agp_unbind(struct file *file, unsigned int cmd,
+				  unsigned long arg)
 {
 	drm_agp_binding32_t __user *argp = (void __user *)arg;
 	struct drm_agp_binding request;
@@ -753,8 +753,8 @@ typedef struct drm_scatter_gather32 {
 	u32 handle;	/**< Used for mapping / unmapping */
 } drm_scatter_gather32_t;
 
-static int compat_drm_sg_alloc(struct file *file, unsigned int cmd,
-			       unsigned long arg)
+static long compat_drm_sg_alloc(struct file *file, unsigned int cmd,
+				unsigned long arg)
 {
 	drm_scatter_gather32_t __user *argp = (void __user *)arg;
 	struct drm_scatter_gather request;
@@ -775,8 +775,8 @@ static int compat_drm_sg_alloc(struct file *file, unsigned int cmd,
 	return 0;
 }
 
-static int compat_drm_sg_free(struct file *file, unsigned int cmd,
-			      unsigned long arg)
+static long compat_drm_sg_free(struct file *file, unsigned int cmd,
+			       unsigned long arg)
 {
 	drm_scatter_gather32_t __user *argp = (void __user *)arg;
 	struct drm_scatter_gather request;
@@ -798,8 +798,8 @@ typedef struct drm_update_draw32 {
 	u64 data;	/**< Pointer */
 } __attribute__((packed)) drm_update_draw32_t;
 
-static int compat_drm_update_draw(struct file *file, unsigned int cmd,
-				  unsigned long arg)
+static long compat_drm_update_draw(struct file *file, unsigned int cmd,
+				   unsigned long arg)
 {
 	drm_update_draw32_t update32;
 	if (copy_from_user(&update32, (void __user *)arg, sizeof(update32)))
@@ -828,8 +828,8 @@ typedef union drm_wait_vblank32 {
 	struct drm_wait_vblank_reply32 reply;
 } drm_wait_vblank32_t;
 
-static int compat_drm_wait_vblank(struct file *file, unsigned int cmd,
-				  unsigned long arg)
+static long compat_drm_wait_vblank(struct file *file, unsigned int cmd,
+				   unsigned long arg)
 {
 	drm_wait_vblank32_t __user *argp = (void __user *)arg;
 	drm_wait_vblank32_t req32;
@@ -869,8 +869,8 @@ typedef struct drm_mode_fb_cmd232 {
 	u64 modifier[4];
 } __attribute__((packed)) drm_mode_fb_cmd232_t;
 
-static int compat_drm_mode_addfb2(struct file *file, unsigned int cmd,
-				  unsigned long arg)
+static long compat_drm_mode_addfb2(struct file *file, unsigned int cmd,
+				   unsigned long arg)
 {
 	struct drm_mode_fb_cmd232 __user *argp = (void __user *)arg;
 	struct drm_mode_fb_cmd2 req64;
diff --git a/drivers/gpu/drm/i915/i915_ioc32.c b/drivers/gpu/drm/i915/i915_ioc32.c
index 97f3a5640289..9034c4c302e2 100644
--- a/drivers/gpu/drm/i915/i915_ioc32.c
+++ b/drivers/gpu/drm/i915/i915_ioc32.c
@@ -45,8 +45,8 @@ struct drm_i915_getparam32 {
 	u32 value;
 };
 
-static int compat_i915_getparam(struct file *file, unsigned int cmd,
-				unsigned long arg)
+static long compat_i915_getparam(struct file *file, unsigned int cmd,
+				 unsigned long arg)
 {
 	struct drm_i915_getparam32 req32;
 	drm_i915_getparam_t __user *request;
diff --git a/drivers/gpu/drm/mga/mga_ioc32.c b/drivers/gpu/drm/mga/mga_ioc32.c
index 245fb2e359cf..aa6e2cbe60ad 100644
--- a/drivers/gpu/drm/mga/mga_ioc32.c
+++ b/drivers/gpu/drm/mga/mga_ioc32.c
@@ -57,8 +57,8 @@ typedef struct drm32_mga_init {
 	u32 buffers_offset;
 } drm_mga_init32_t;
 
-static int compat_mga_init(struct file *file, unsigned int cmd,
-			   unsigned long arg)
+static long compat_mga_init(struct file *file, unsigned int cmd,
+			    unsigned long arg)
 {
 	drm_mga_init32_t init32;
 	drm_mga_init_t init;
@@ -87,8 +87,8 @@ typedef struct drm_mga_getparam32 {
 	u32 value;
 } drm_mga_getparam32_t;
 
-static int compat_mga_getparam(struct file *file, unsigned int cmd,
-			       unsigned long arg)
+static long compat_mga_getparam(struct file *file, unsigned int cmd,
+				unsigned long arg)
 {
 	drm_mga_getparam32_t getparam32;
 	drm_mga_getparam_t getparam;
@@ -111,8 +111,8 @@ typedef struct drm_mga_drm_bootstrap32 {
 	u8 agp_size;
 } drm_mga_dma_bootstrap32_t;
 
-static int compat_mga_dma_bootstrap(struct file *file, unsigned int cmd,
-				    unsigned long arg)
+static long compat_mga_dma_bootstrap(struct file *file, unsigned int cmd,
+				     unsigned long arg)
 {
 	drm_mga_dma_bootstrap32_t dma_bootstrap32;
 	drm_mga_dma_bootstrap_t dma_bootstrap;
diff --git a/drivers/gpu/drm/r128/r128_ioc32.c b/drivers/gpu/drm/r128/r128_ioc32.c
index 663f38c63ba6..8a40964be10b 100644
--- a/drivers/gpu/drm/r128/r128_ioc32.c
+++ b/drivers/gpu/drm/r128/r128_ioc32.c
@@ -59,8 +59,8 @@ typedef struct drm_r128_init32 {
 	unsigned int agp_textures_offset;
 } drm_r128_init32_t;
 
-static int compat_r128_init(struct file *file, unsigned int cmd,
-			    unsigned long arg)
+static long compat_r128_init(struct file *file, unsigned int cmd,
+			     unsigned long arg)
 {
 	drm_r128_init32_t init32;
 	drm_r128_init_t __user *init;
@@ -107,8 +107,8 @@ typedef struct drm_r128_depth32 {
 	u32 mask;
 } drm_r128_depth32_t;
 
-static int compat_r128_depth(struct file *file, unsigned int cmd,
-			     unsigned long arg)
+static long compat_r128_depth(struct file *file, unsigned int cmd,
+			      unsigned long arg)
 {
 	drm_r128_depth32_t depth32;
 	drm_r128_depth_t __user *depth;
@@ -136,8 +136,8 @@ typedef struct drm_r128_stipple32 {
 	u32 mask;
 } drm_r128_stipple32_t;
 
-static int compat_r128_stipple(struct file *file, unsigned int cmd,
-			       unsigned long arg)
+static long compat_r128_stipple(struct file *file, unsigned int cmd,
+				unsigned long arg)
 {
 	drm_r128_stipple32_t stipple32;
 	drm_r128_stipple_t __user *stipple;
@@ -159,8 +159,8 @@ typedef struct drm_r128_getparam32 {
 	u32 value;
 } drm_r128_getparam32_t;
 
-static int compat_r128_getparam(struct file *file, unsigned int cmd,
-				unsigned long arg)
+static long compat_r128_getparam(struct file *file, unsigned int cmd,
+				 unsigned long arg)
 {
 	drm_r128_getparam32_t getparam32;
 	drm_r128_getparam_t __user *getparam;
diff --git a/include/drm/drm_ioctl.h b/include/drm/drm_ioctl.h
index 917fe38a1757..c696d9f0f8de 100644
--- a/include/drm/drm_ioctl.h
+++ b/include/drm/drm_ioctl.h
@@ -64,8 +64,9 @@ typedef int drm_ioctl_t(struct drm_device *dev, void *data,
  * New drivers shouldn't screw up the structure layout for their ioctl
  * structures and hence never need this.
  */
-typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
-			       unsigned long arg);
+typedef long drm_ioctl_compat_t(struct file *filp,
+				unsigned int cmd,
+				unsigned long arg);
 
 #define DRM_IOCTL_NR(n)                _IOC_NR(n)
 #define DRM_MAJOR       226
-- 
2.14.1



More information about the Intel-gfx-trybot mailing list