aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/radeon_ioc32.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/radeon_ioc32.c')
-rw-r--r--drivers/char/drm/radeon_ioc32.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/drivers/char/drm/radeon_ioc32.c b/drivers/char/drm/radeon_ioc32.c
index bfe612215fb3..fef4a2b84c1e 100644
--- a/drivers/char/drm/radeon_ioc32.c
+++ b/drivers/char/drm/radeon_ioc32.c
@@ -94,7 +94,7 @@ static int compat_radeon_cp_init(struct file *file, unsigned int cmd,
94 return -EFAULT; 94 return -EFAULT;
95 95
96 return drm_ioctl(file->f_dentry->d_inode, file, 96 return drm_ioctl(file->f_dentry->d_inode, file,
97 DRM_IOCTL_RADEON_CP_INIT, (unsigned long) init); 97 DRM_IOCTL_RADEON_CP_INIT, (unsigned long)init);
98} 98}
99 99
100typedef struct drm_radeon_clear32 { 100typedef struct drm_radeon_clear32 {
@@ -102,8 +102,8 @@ typedef struct drm_radeon_clear32 {
102 unsigned int clear_color; 102 unsigned int clear_color;
103 unsigned int clear_depth; 103 unsigned int clear_depth;
104 unsigned int color_mask; 104 unsigned int color_mask;
105 unsigned int depth_mask; /* misnamed field: should be stencil */ 105 unsigned int depth_mask; /* misnamed field: should be stencil */
106 u32 depth_boxes; 106 u32 depth_boxes;
107} drm_radeon_clear32_t; 107} drm_radeon_clear32_t;
108 108
109static int compat_radeon_cp_clear(struct file *file, unsigned int cmd, 109static int compat_radeon_cp_clear(struct file *file, unsigned int cmd,
@@ -127,7 +127,7 @@ static int compat_radeon_cp_clear(struct file *file, unsigned int cmd,
127 return -EFAULT; 127 return -EFAULT;
128 128
129 return drm_ioctl(file->f_dentry->d_inode, file, 129 return drm_ioctl(file->f_dentry->d_inode, file,
130 DRM_IOCTL_RADEON_CLEAR, (unsigned long) clr); 130 DRM_IOCTL_RADEON_CLEAR, (unsigned long)clr);
131} 131}
132 132
133typedef struct drm_radeon_stipple32 { 133typedef struct drm_radeon_stipple32 {
@@ -137,7 +137,7 @@ typedef struct drm_radeon_stipple32 {
137static int compat_radeon_cp_stipple(struct file *file, unsigned int cmd, 137static int compat_radeon_cp_stipple(struct file *file, unsigned int cmd,
138 unsigned long arg) 138 unsigned long arg)
139{ 139{
140 drm_radeon_stipple32_t __user *argp = (void __user *) arg; 140 drm_radeon_stipple32_t __user *argp = (void __user *)arg;
141 drm_radeon_stipple_t __user *request; 141 drm_radeon_stipple_t __user *request;
142 u32 mask; 142 u32 mask;
143 143
@@ -146,16 +146,16 @@ static int compat_radeon_cp_stipple(struct file *file, unsigned int cmd,
146 146
147 request = compat_alloc_user_space(sizeof(*request)); 147 request = compat_alloc_user_space(sizeof(*request));
148 if (!access_ok(VERIFY_WRITE, request, sizeof(*request)) 148 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
149 || __put_user((unsigned int __user *)(unsigned long) mask, 149 || __put_user((unsigned int __user *)(unsigned long)mask,
150 &request->mask)) 150 &request->mask))
151 return -EFAULT; 151 return -EFAULT;
152 152
153 return drm_ioctl(file->f_dentry->d_inode, file, 153 return drm_ioctl(file->f_dentry->d_inode, file,
154 DRM_IOCTL_RADEON_STIPPLE, (unsigned long) request); 154 DRM_IOCTL_RADEON_STIPPLE, (unsigned long)request);
155} 155}
156 156
157typedef struct drm_radeon_tex_image32 { 157typedef struct drm_radeon_tex_image32 {
158 unsigned int x, y; /* Blit coordinates */ 158 unsigned int x, y; /* Blit coordinates */
159 unsigned int width, height; 159 unsigned int width, height;
160 u32 data; 160 u32 data;
161} drm_radeon_tex_image32_t; 161} drm_radeon_tex_image32_t;
@@ -164,7 +164,7 @@ typedef struct drm_radeon_texture32 {
164 unsigned int offset; 164 unsigned int offset;
165 int pitch; 165 int pitch;
166 int format; 166 int format;
167 int width; /* Texture image coordinates */ 167 int width; /* Texture image coordinates */
168 int height; 168 int height;
169 u32 image; 169 u32 image;
170} drm_radeon_texture32_t; 170} drm_radeon_texture32_t;
@@ -177,7 +177,7 @@ static int compat_radeon_cp_texture(struct file *file, unsigned int cmd,
177 drm_radeon_tex_image32_t img32; 177 drm_radeon_tex_image32_t img32;
178 drm_radeon_tex_image_t __user *image; 178 drm_radeon_tex_image_t __user *image;
179 179
180 if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) 180 if (copy_from_user(&req32, (void __user *)arg, sizeof(req32)))
181 return -EFAULT; 181 return -EFAULT;
182 if (req32.image == 0) 182 if (req32.image == 0)
183 return -EINVAL; 183 return -EINVAL;
@@ -206,12 +206,12 @@ static int compat_radeon_cp_texture(struct file *file, unsigned int cmd,
206 return -EFAULT; 206 return -EFAULT;
207 207
208 return drm_ioctl(file->f_dentry->d_inode, file, 208 return drm_ioctl(file->f_dentry->d_inode, file,
209 DRM_IOCTL_RADEON_TEXTURE, (unsigned long) request); 209 DRM_IOCTL_RADEON_TEXTURE, (unsigned long)request);
210} 210}
211 211
212typedef struct drm_radeon_vertex2_32 { 212typedef struct drm_radeon_vertex2_32 {
213 int idx; /* Index of vertex buffer */ 213 int idx; /* Index of vertex buffer */
214 int discard; /* Client finished with buffer? */ 214 int discard; /* Client finished with buffer? */
215 int nr_states; 215 int nr_states;
216 u32 state; 216 u32 state;
217 int nr_prims; 217 int nr_prims;
@@ -224,7 +224,7 @@ static int compat_radeon_cp_vertex2(struct file *file, unsigned int cmd,
224 drm_radeon_vertex2_32_t req32; 224 drm_radeon_vertex2_32_t req32;
225 drm_radeon_vertex2_t __user *request; 225 drm_radeon_vertex2_t __user *request;
226 226
227 if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) 227 if (copy_from_user(&req32, (void __user *)arg, sizeof(req32)))
228 return -EFAULT; 228 return -EFAULT;
229 229
230 request = compat_alloc_user_space(sizeof(*request)); 230 request = compat_alloc_user_space(sizeof(*request));
@@ -240,7 +240,7 @@ static int compat_radeon_cp_vertex2(struct file *file, unsigned int cmd,
240 return -EFAULT; 240 return -EFAULT;
241 241
242 return drm_ioctl(file->f_dentry->d_inode, file, 242 return drm_ioctl(file->f_dentry->d_inode, file,
243 DRM_IOCTL_RADEON_VERTEX2, (unsigned long) request); 243 DRM_IOCTL_RADEON_VERTEX2, (unsigned long)request);
244} 244}
245 245
246typedef struct drm_radeon_cmd_buffer32 { 246typedef struct drm_radeon_cmd_buffer32 {
@@ -256,7 +256,7 @@ static int compat_radeon_cp_cmdbuf(struct file *file, unsigned int cmd,
256 drm_radeon_cmd_buffer32_t req32; 256 drm_radeon_cmd_buffer32_t req32;
257 drm_radeon_cmd_buffer_t __user *request; 257 drm_radeon_cmd_buffer_t __user *request;
258 258
259 if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) 259 if (copy_from_user(&req32, (void __user *)arg, sizeof(req32)))
260 return -EFAULT; 260 return -EFAULT;
261 261
262 request = compat_alloc_user_space(sizeof(*request)); 262 request = compat_alloc_user_space(sizeof(*request));
@@ -270,7 +270,7 @@ static int compat_radeon_cp_cmdbuf(struct file *file, unsigned int cmd,
270 return -EFAULT; 270 return -EFAULT;
271 271
272 return drm_ioctl(file->f_dentry->d_inode, file, 272 return drm_ioctl(file->f_dentry->d_inode, file,
273 DRM_IOCTL_RADEON_CMDBUF, (unsigned long) request); 273 DRM_IOCTL_RADEON_CMDBUF, (unsigned long)request);
274} 274}
275 275
276typedef struct drm_radeon_getparam32 { 276typedef struct drm_radeon_getparam32 {
@@ -284,7 +284,7 @@ static int compat_radeon_cp_getparam(struct file *file, unsigned int cmd,
284 drm_radeon_getparam32_t req32; 284 drm_radeon_getparam32_t req32;
285 drm_radeon_getparam_t __user *request; 285 drm_radeon_getparam_t __user *request;
286 286
287 if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) 287 if (copy_from_user(&req32, (void __user *)arg, sizeof(req32)))
288 return -EFAULT; 288 return -EFAULT;
289 289
290 request = compat_alloc_user_space(sizeof(*request)); 290 request = compat_alloc_user_space(sizeof(*request));
@@ -295,7 +295,7 @@ static int compat_radeon_cp_getparam(struct file *file, unsigned int cmd,
295 return -EFAULT; 295 return -EFAULT;
296 296
297 return drm_ioctl(file->f_dentry->d_inode, file, 297 return drm_ioctl(file->f_dentry->d_inode, file,
298 DRM_IOCTL_RADEON_GETPARAM, (unsigned long) request); 298 DRM_IOCTL_RADEON_GETPARAM, (unsigned long)request);
299} 299}
300 300
301typedef struct drm_radeon_mem_alloc32 { 301typedef struct drm_radeon_mem_alloc32 {
@@ -311,7 +311,7 @@ static int compat_radeon_mem_alloc(struct file *file, unsigned int cmd,
311 drm_radeon_mem_alloc32_t req32; 311 drm_radeon_mem_alloc32_t req32;
312 drm_radeon_mem_alloc_t __user *request; 312 drm_radeon_mem_alloc_t __user *request;
313 313
314 if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) 314 if (copy_from_user(&req32, (void __user *)arg, sizeof(req32)))
315 return -EFAULT; 315 return -EFAULT;
316 316
317 request = compat_alloc_user_space(sizeof(*request)); 317 request = compat_alloc_user_space(sizeof(*request));
@@ -324,7 +324,7 @@ static int compat_radeon_mem_alloc(struct file *file, unsigned int cmd,
324 return -EFAULT; 324 return -EFAULT;
325 325
326 return drm_ioctl(file->f_dentry->d_inode, file, 326 return drm_ioctl(file->f_dentry->d_inode, file,
327 DRM_IOCTL_RADEON_ALLOC, (unsigned long) request); 327 DRM_IOCTL_RADEON_ALLOC, (unsigned long)request);
328} 328}
329 329
330typedef struct drm_radeon_irq_emit32 { 330typedef struct drm_radeon_irq_emit32 {
@@ -337,7 +337,7 @@ static int compat_radeon_irq_emit(struct file *file, unsigned int cmd,
337 drm_radeon_irq_emit32_t req32; 337 drm_radeon_irq_emit32_t req32;
338 drm_radeon_irq_emit_t __user *request; 338 drm_radeon_irq_emit_t __user *request;
339 339
340 if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) 340 if (copy_from_user(&req32, (void __user *)arg, sizeof(req32)))
341 return -EFAULT; 341 return -EFAULT;
342 342
343 request = compat_alloc_user_space(sizeof(*request)); 343 request = compat_alloc_user_space(sizeof(*request));
@@ -347,7 +347,7 @@ static int compat_radeon_irq_emit(struct file *file, unsigned int cmd,
347 return -EFAULT; 347 return -EFAULT;
348 348
349 return drm_ioctl(file->f_dentry->d_inode, file, 349 return drm_ioctl(file->f_dentry->d_inode, file,
350 DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long) request); 350 DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long)request);
351} 351}
352 352
353drm_ioctl_compat_t *radeon_compat_ioctls[] = { 353drm_ioctl_compat_t *radeon_compat_ioctls[] = {
@@ -371,8 +371,7 @@ drm_ioctl_compat_t *radeon_compat_ioctls[] = {
371 * \param arg user argument. 371 * \param arg user argument.
372 * \return zero on success or negative number on failure. 372 * \return zero on success or negative number on failure.
373 */ 373 */
374long radeon_compat_ioctl(struct file *filp, unsigned int cmd, 374long radeon_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
375 unsigned long arg)
376{ 375{
377 unsigned int nr = DRM_IOCTL_NR(cmd); 376 unsigned int nr = DRM_IOCTL_NR(cmd);
378 drm_ioctl_compat_t *fn = NULL; 377 drm_ioctl_compat_t *fn = NULL;
@@ -386,7 +385,7 @@ long radeon_compat_ioctl(struct file *filp, unsigned int cmd,
386 385
387 lock_kernel(); /* XXX for now */ 386 lock_kernel(); /* XXX for now */
388 if (fn != NULL) 387 if (fn != NULL)
389 ret = (*fn)(filp, cmd, arg); 388 ret = (*fn) (filp, cmd, arg);
390 else 389 else
391 ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg); 390 ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
392 unlock_kernel(); 391 unlock_kernel();