aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_ioc32.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/drm_ioc32.c')
-rw-r--r--drivers/char/drm/drm_ioc32.c225
1 files changed, 113 insertions, 112 deletions
diff --git a/drivers/char/drm/drm_ioc32.c b/drivers/char/drm/drm_ioc32.c
index 8087a9636399..dd91ff6b474c 100644
--- a/drivers/char/drm/drm_ioc32.c
+++ b/drivers/char/drm/drm_ioc32.c
@@ -68,15 +68,15 @@
68#define DRM_IOCTL_WAIT_VBLANK32 DRM_IOWR(0x3a, drm_wait_vblank32_t) 68#define DRM_IOCTL_WAIT_VBLANK32 DRM_IOWR(0x3a, drm_wait_vblank32_t)
69 69
70typedef struct drm_version_32 { 70typedef struct drm_version_32 {
71 int version_major; /**< Major version */ 71 int version_major; /**< Major version */
72 int version_minor; /**< Minor version */ 72 int version_minor; /**< Minor version */
73 int version_patchlevel;/**< Patch level */ 73 int version_patchlevel; /**< Patch level */
74 u32 name_len; /**< Length of name buffer */ 74 u32 name_len; /**< Length of name buffer */
75 u32 name; /**< Name of driver */ 75 u32 name; /**< Name of driver */
76 u32 date_len; /**< Length of date buffer */ 76 u32 date_len; /**< Length of date buffer */
77 u32 date; /**< User-space buffer to hold date */ 77 u32 date; /**< User-space buffer to hold date */
78 u32 desc_len; /**< Length of desc buffer */ 78 u32 desc_len; /**< Length of desc buffer */
79 u32 desc; /**< User-space buffer to hold desc */ 79 u32 desc; /**< User-space buffer to hold desc */
80} drm_version32_t; 80} drm_version32_t;
81 81
82static int compat_drm_version(struct file *file, unsigned int cmd, 82static int compat_drm_version(struct file *file, unsigned int cmd,
@@ -86,7 +86,7 @@ static int compat_drm_version(struct file *file, unsigned int cmd,
86 drm_version_t __user *version; 86 drm_version_t __user *version;
87 int err; 87 int err;
88 88
89 if (copy_from_user(&v32, (void __user *) arg, sizeof(v32))) 89 if (copy_from_user(&v32, (void __user *)arg, sizeof(v32)))
90 return -EFAULT; 90 return -EFAULT;
91 91
92 version = compat_alloc_user_space(sizeof(*version)); 92 version = compat_alloc_user_space(sizeof(*version));
@@ -104,7 +104,7 @@ static int compat_drm_version(struct file *file, unsigned int cmd,
104 return -EFAULT; 104 return -EFAULT;
105 105
106 err = drm_ioctl(file->f_dentry->d_inode, file, 106 err = drm_ioctl(file->f_dentry->d_inode, file,
107 DRM_IOCTL_VERSION, (unsigned long) version); 107 DRM_IOCTL_VERSION, (unsigned long)version);
108 if (err) 108 if (err)
109 return err; 109 return err;
110 110
@@ -116,7 +116,7 @@ static int compat_drm_version(struct file *file, unsigned int cmd,
116 || __get_user(v32.desc_len, &version->desc_len)) 116 || __get_user(v32.desc_len, &version->desc_len))
117 return -EFAULT; 117 return -EFAULT;
118 118
119 if (copy_to_user((void __user *) arg, &v32, sizeof(v32))) 119 if (copy_to_user((void __user *)arg, &v32, sizeof(v32)))
120 return -EFAULT; 120 return -EFAULT;
121 return 0; 121 return 0;
122} 122}
@@ -133,25 +133,25 @@ static int compat_drm_getunique(struct file *file, unsigned int cmd,
133 drm_unique_t __user *u; 133 drm_unique_t __user *u;
134 int err; 134 int err;
135 135
136 if (copy_from_user(&uq32, (void __user *) arg, sizeof(uq32))) 136 if (copy_from_user(&uq32, (void __user *)arg, sizeof(uq32)))
137 return -EFAULT; 137 return -EFAULT;
138 138
139 u = compat_alloc_user_space(sizeof(*u)); 139 u = compat_alloc_user_space(sizeof(*u));
140 if (!access_ok(VERIFY_WRITE, u, sizeof(*u))) 140 if (!access_ok(VERIFY_WRITE, u, sizeof(*u)))
141 return -EFAULT; 141 return -EFAULT;
142 if (__put_user(uq32.unique_len, &u->unique_len) 142 if (__put_user(uq32.unique_len, &u->unique_len)
143 || __put_user((void __user *)(unsigned long) uq32.unique, 143 || __put_user((void __user *)(unsigned long)uq32.unique,
144 &u->unique)) 144 &u->unique))
145 return -EFAULT; 145 return -EFAULT;
146 146
147 err = drm_ioctl(file->f_dentry->d_inode, file, 147 err = drm_ioctl(file->f_dentry->d_inode, file,
148 DRM_IOCTL_GET_UNIQUE, (unsigned long) u); 148 DRM_IOCTL_GET_UNIQUE, (unsigned long)u);
149 if (err) 149 if (err)
150 return err; 150 return err;
151 151
152 if (__get_user(uq32.unique_len, &u->unique_len)) 152 if (__get_user(uq32.unique_len, &u->unique_len))
153 return -EFAULT; 153 return -EFAULT;
154 if (copy_to_user((void __user *) arg, &uq32, sizeof(uq32))) 154 if (copy_to_user((void __user *)arg, &uq32, sizeof(uq32)))
155 return -EFAULT; 155 return -EFAULT;
156 return 0; 156 return 0;
157} 157}
@@ -162,28 +162,28 @@ static int compat_drm_setunique(struct file *file, unsigned int cmd,
162 drm_unique32_t uq32; 162 drm_unique32_t uq32;
163 drm_unique_t __user *u; 163 drm_unique_t __user *u;
164 164
165 if (copy_from_user(&uq32, (void __user *) arg, sizeof(uq32))) 165 if (copy_from_user(&uq32, (void __user *)arg, sizeof(uq32)))
166 return -EFAULT; 166 return -EFAULT;
167 167
168 u = compat_alloc_user_space(sizeof(*u)); 168 u = compat_alloc_user_space(sizeof(*u));
169 if (!access_ok(VERIFY_WRITE, u, sizeof(*u))) 169 if (!access_ok(VERIFY_WRITE, u, sizeof(*u)))
170 return -EFAULT; 170 return -EFAULT;
171 if (__put_user(uq32.unique_len, &u->unique_len) 171 if (__put_user(uq32.unique_len, &u->unique_len)
172 || __put_user((void __user *)(unsigned long) uq32.unique, 172 || __put_user((void __user *)(unsigned long)uq32.unique,
173 &u->unique)) 173 &u->unique))
174 return -EFAULT; 174 return -EFAULT;
175 175
176 return drm_ioctl(file->f_dentry->d_inode, file, 176 return drm_ioctl(file->f_dentry->d_inode, file,
177 DRM_IOCTL_SET_UNIQUE, (unsigned long) u); 177 DRM_IOCTL_SET_UNIQUE, (unsigned long)u);
178} 178}
179 179
180typedef struct drm_map32 { 180typedef struct drm_map32 {
181 u32 offset; /**< Requested physical address (0 for SAREA)*/ 181 u32 offset; /**< Requested physical address (0 for SAREA)*/
182 u32 size; /**< Requested physical size (bytes) */ 182 u32 size; /**< Requested physical size (bytes) */
183 drm_map_type_t type; /**< Type of memory to map */ 183 drm_map_type_t type; /**< Type of memory to map */
184 drm_map_flags_t flags; /**< Flags */ 184 drm_map_flags_t flags; /**< Flags */
185 u32 handle; /**< User-space: "Handle" to pass to mmap() */ 185 u32 handle; /**< User-space: "Handle" to pass to mmap() */
186 int mtrr; /**< MTRR slot used */ 186 int mtrr; /**< MTRR slot used */
187} drm_map32_t; 187} drm_map32_t;
188 188
189static int compat_drm_getmap(struct file *file, unsigned int cmd, 189static int compat_drm_getmap(struct file *file, unsigned int cmd,
@@ -205,7 +205,7 @@ static int compat_drm_getmap(struct file *file, unsigned int cmd,
205 return -EFAULT; 205 return -EFAULT;
206 206
207 err = drm_ioctl(file->f_dentry->d_inode, file, 207 err = drm_ioctl(file->f_dentry->d_inode, file,
208 DRM_IOCTL_GET_MAP, (unsigned long) map); 208 DRM_IOCTL_GET_MAP, (unsigned long)map);
209 if (err) 209 if (err)
210 return err; 210 return err;
211 211
@@ -217,7 +217,7 @@ static int compat_drm_getmap(struct file *file, unsigned int cmd,
217 || __get_user(m32.mtrr, &map->mtrr)) 217 || __get_user(m32.mtrr, &map->mtrr))
218 return -EFAULT; 218 return -EFAULT;
219 219
220 m32.handle = (unsigned long) handle; 220 m32.handle = (unsigned long)handle;
221 if (copy_to_user(argp, &m32, sizeof(m32))) 221 if (copy_to_user(argp, &m32, sizeof(m32)))
222 return -EFAULT; 222 return -EFAULT;
223 return 0; 223 return 0;
@@ -246,7 +246,7 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd,
246 return -EFAULT; 246 return -EFAULT;
247 247
248 err = drm_ioctl(file->f_dentry->d_inode, file, 248 err = drm_ioctl(file->f_dentry->d_inode, file,
249 DRM_IOCTL_ADD_MAP, (unsigned long) map); 249 DRM_IOCTL_ADD_MAP, (unsigned long)map);
250 if (err) 250 if (err)
251 return err; 251 return err;
252 252
@@ -255,8 +255,8 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd,
255 || __get_user(handle, &map->handle)) 255 || __get_user(handle, &map->handle))
256 return -EFAULT; 256 return -EFAULT;
257 257
258 m32.handle = (unsigned long) handle; 258 m32.handle = (unsigned long)handle;
259 if (m32.handle != (unsigned long) handle && printk_ratelimit()) 259 if (m32.handle != (unsigned long)handle && printk_ratelimit())
260 printk(KERN_ERR "compat_drm_addmap truncated handle" 260 printk(KERN_ERR "compat_drm_addmap truncated handle"
261 " %p for type %d offset %x\n", 261 " %p for type %d offset %x\n",
262 handle, m32.type, m32.offset); 262 handle, m32.type, m32.offset);
@@ -280,20 +280,20 @@ static int compat_drm_rmmap(struct file *file, unsigned int cmd,
280 map = compat_alloc_user_space(sizeof(*map)); 280 map = compat_alloc_user_space(sizeof(*map));
281 if (!access_ok(VERIFY_WRITE, map, sizeof(*map))) 281 if (!access_ok(VERIFY_WRITE, map, sizeof(*map)))
282 return -EFAULT; 282 return -EFAULT;
283 if (__put_user((void *)(unsigned long) handle, &map->handle)) 283 if (__put_user((void *)(unsigned long)handle, &map->handle))
284 return -EFAULT; 284 return -EFAULT;
285 285
286 return drm_ioctl(file->f_dentry->d_inode, file, 286 return drm_ioctl(file->f_dentry->d_inode, file,
287 DRM_IOCTL_RM_MAP, (unsigned long) map); 287 DRM_IOCTL_RM_MAP, (unsigned long)map);
288} 288}
289 289
290typedef struct drm_client32 { 290typedef struct drm_client32 {
291 int idx; /**< Which client desired? */ 291 int idx; /**< Which client desired? */
292 int auth; /**< Is client authenticated? */ 292 int auth; /**< Is client authenticated? */
293 u32 pid; /**< Process ID */ 293 u32 pid; /**< Process ID */
294 u32 uid; /**< User ID */ 294 u32 uid; /**< User ID */
295 u32 magic; /**< Magic */ 295 u32 magic; /**< Magic */
296 u32 iocs; /**< Ioctl count */ 296 u32 iocs; /**< Ioctl count */
297} drm_client32_t; 297} drm_client32_t;
298 298
299static int compat_drm_getclient(struct file *file, unsigned int cmd, 299static int compat_drm_getclient(struct file *file, unsigned int cmd,
@@ -314,7 +314,7 @@ static int compat_drm_getclient(struct file *file, unsigned int cmd,
314 return -EFAULT; 314 return -EFAULT;
315 315
316 err = drm_ioctl(file->f_dentry->d_inode, file, 316 err = drm_ioctl(file->f_dentry->d_inode, file,
317 DRM_IOCTL_GET_CLIENT, (unsigned long) client); 317 DRM_IOCTL_GET_CLIENT, (unsigned long)client);
318 if (err) 318 if (err)
319 return err; 319 return err;
320 320
@@ -351,7 +351,7 @@ static int compat_drm_getstats(struct file *file, unsigned int cmd,
351 return -EFAULT; 351 return -EFAULT;
352 352
353 err = drm_ioctl(file->f_dentry->d_inode, file, 353 err = drm_ioctl(file->f_dentry->d_inode, file,
354 DRM_IOCTL_GET_STATS, (unsigned long) stats); 354 DRM_IOCTL_GET_STATS, (unsigned long)stats);
355 if (err) 355 if (err)
356 return err; 356 return err;
357 357
@@ -368,12 +368,12 @@ static int compat_drm_getstats(struct file *file, unsigned int cmd,
368} 368}
369 369
370typedef struct drm_buf_desc32 { 370typedef struct drm_buf_desc32 {
371 int count; /**< Number of buffers of this size */ 371 int count; /**< Number of buffers of this size */
372 int size; /**< Size in bytes */ 372 int size; /**< Size in bytes */
373 int low_mark; /**< Low water mark */ 373 int low_mark; /**< Low water mark */
374 int high_mark; /**< High water mark */ 374 int high_mark; /**< High water mark */
375 int flags; 375 int flags;
376 u32 agp_start; /**< Start address in the AGP aperture */ 376 u32 agp_start; /**< Start address in the AGP aperture */
377} drm_buf_desc32_t; 377} drm_buf_desc32_t;
378 378
379static int compat_drm_addbufs(struct file *file, unsigned int cmd, 379static int compat_drm_addbufs(struct file *file, unsigned int cmd,
@@ -395,7 +395,7 @@ static int compat_drm_addbufs(struct file *file, unsigned int cmd,
395 return -EFAULT; 395 return -EFAULT;
396 396
397 err = drm_ioctl(file->f_dentry->d_inode, file, 397 err = drm_ioctl(file->f_dentry->d_inode, file,
398 DRM_IOCTL_ADD_BUFS, (unsigned long) buf); 398 DRM_IOCTL_ADD_BUFS, (unsigned long)buf);
399 if (err) 399 if (err)
400 return err; 400 return err;
401 401
@@ -427,12 +427,12 @@ static int compat_drm_markbufs(struct file *file, unsigned int cmd,
427 return -EFAULT; 427 return -EFAULT;
428 428
429 return drm_ioctl(file->f_dentry->d_inode, file, 429 return drm_ioctl(file->f_dentry->d_inode, file,
430 DRM_IOCTL_MARK_BUFS, (unsigned long) buf); 430 DRM_IOCTL_MARK_BUFS, (unsigned long)buf);
431} 431}
432 432
433typedef struct drm_buf_info32 { 433typedef struct drm_buf_info32 {
434 int count; /**< Entries in list */ 434 int count; /**< Entries in list */
435 u32 list; 435 u32 list;
436} drm_buf_info32_t; 436} drm_buf_info32_t;
437 437
438static int compat_drm_infobufs(struct file *file, unsigned int cmd, 438static int compat_drm_infobufs(struct file *file, unsigned int cmd,
@@ -451,7 +451,7 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd,
451 return -EFAULT; 451 return -EFAULT;
452 452
453 count = req32.count; 453 count = req32.count;
454 to = (drm_buf_desc32_t __user *)(unsigned long) req32.list; 454 to = (drm_buf_desc32_t __user *) (unsigned long)req32.list;
455 if (count < 0) 455 if (count < 0)
456 count = 0; 456 count = 0;
457 if (count > 0 457 if (count > 0
@@ -469,7 +469,7 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd,
469 return -EFAULT; 469 return -EFAULT;
470 470
471 err = drm_ioctl(file->f_dentry->d_inode, file, 471 err = drm_ioctl(file->f_dentry->d_inode, file,
472 DRM_IOCTL_INFO_BUFS, (unsigned long) request); 472 DRM_IOCTL_INFO_BUFS, (unsigned long)request);
473 if (err) 473 if (err)
474 return err; 474 return err;
475 475
@@ -488,16 +488,16 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd,
488} 488}
489 489
490typedef struct drm_buf_pub32 { 490typedef struct drm_buf_pub32 {
491 int idx; /**< Index into the master buffer list */ 491 int idx; /**< Index into the master buffer list */
492 int total; /**< Buffer size */ 492 int total; /**< Buffer size */
493 int used; /**< Amount of buffer in use (for DMA) */ 493 int used; /**< Amount of buffer in use (for DMA) */
494 u32 address; /**< Address of buffer */ 494 u32 address; /**< Address of buffer */
495} drm_buf_pub32_t; 495} drm_buf_pub32_t;
496 496
497typedef struct drm_buf_map32 { 497typedef struct drm_buf_map32 {
498 int count; /**< Length of the buffer list */ 498 int count; /**< Length of the buffer list */
499 u32 virtual; /**< Mmap'd area in user-virtual */ 499 u32 virtual; /**< Mmap'd area in user-virtual */
500 u32 list; /**< Buffer information */ 500 u32 list; /**< Buffer information */
501} drm_buf_map32_t; 501} drm_buf_map32_t;
502 502
503static int compat_drm_mapbufs(struct file *file, unsigned int cmd, 503static int compat_drm_mapbufs(struct file *file, unsigned int cmd,
@@ -531,7 +531,7 @@ static int compat_drm_mapbufs(struct file *file, unsigned int cmd,
531 return -EFAULT; 531 return -EFAULT;
532 532
533 err = drm_ioctl(file->f_dentry->d_inode, file, 533 err = drm_ioctl(file->f_dentry->d_inode, file,
534 DRM_IOCTL_MAP_BUFS, (unsigned long) request); 534 DRM_IOCTL_MAP_BUFS, (unsigned long)request);
535 if (err) 535 if (err)
536 return err; 536 return err;
537 537
@@ -542,21 +542,21 @@ static int compat_drm_mapbufs(struct file *file, unsigned int cmd,
542 if (__copy_in_user(&list32[i], &list[i], 542 if (__copy_in_user(&list32[i], &list[i],
543 offsetof(drm_buf_pub_t, address)) 543 offsetof(drm_buf_pub_t, address))
544 || __get_user(addr, &list[i].address) 544 || __get_user(addr, &list[i].address)
545 || __put_user((unsigned long) addr, 545 || __put_user((unsigned long)addr,
546 &list32[i].address)) 546 &list32[i].address))
547 return -EFAULT; 547 return -EFAULT;
548 548
549 if (__put_user(actual, &argp->count) 549 if (__put_user(actual, &argp->count)
550 || __get_user(addr, &request->virtual) 550 || __get_user(addr, &request->virtual)
551 || __put_user((unsigned long) addr, &argp->virtual)) 551 || __put_user((unsigned long)addr, &argp->virtual))
552 return -EFAULT; 552 return -EFAULT;
553 553
554 return 0; 554 return 0;
555} 555}
556 556
557typedef struct drm_buf_free32 { 557typedef struct drm_buf_free32 {
558 int count; 558 int count;
559 u32 list; 559 u32 list;
560} drm_buf_free32_t; 560} drm_buf_free32_t;
561 561
562static int compat_drm_freebufs(struct file *file, unsigned int cmd, 562static int compat_drm_freebufs(struct file *file, unsigned int cmd,
@@ -573,17 +573,17 @@ static int compat_drm_freebufs(struct file *file, unsigned int cmd,
573 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))) 573 if (!access_ok(VERIFY_WRITE, request, sizeof(*request)))
574 return -EFAULT; 574 return -EFAULT;
575 if (__put_user(req32.count, &request->count) 575 if (__put_user(req32.count, &request->count)
576 || __put_user((int __user *)(unsigned long) req32.list, 576 || __put_user((int __user *)(unsigned long)req32.list,
577 &request->list)) 577 &request->list))
578 return -EFAULT; 578 return -EFAULT;
579 579
580 return drm_ioctl(file->f_dentry->d_inode, file, 580 return drm_ioctl(file->f_dentry->d_inode, file,
581 DRM_IOCTL_FREE_BUFS, (unsigned long) request); 581 DRM_IOCTL_FREE_BUFS, (unsigned long)request);
582} 582}
583 583
584typedef struct drm_ctx_priv_map32 { 584typedef struct drm_ctx_priv_map32 {
585 unsigned int ctx_id; /**< Context requesting private mapping */ 585 unsigned int ctx_id; /**< Context requesting private mapping */
586 u32 handle; /**< Handle of map */ 586 u32 handle; /**< Handle of map */
587} drm_ctx_priv_map32_t; 587} drm_ctx_priv_map32_t;
588 588
589static int compat_drm_setsareactx(struct file *file, unsigned int cmd, 589static int compat_drm_setsareactx(struct file *file, unsigned int cmd,
@@ -600,12 +600,12 @@ static int compat_drm_setsareactx(struct file *file, unsigned int cmd,
600 if (!access_ok(VERIFY_WRITE, request, sizeof(*request))) 600 if (!access_ok(VERIFY_WRITE, request, sizeof(*request)))
601 return -EFAULT; 601 return -EFAULT;
602 if (__put_user(req32.ctx_id, &request->ctx_id) 602 if (__put_user(req32.ctx_id, &request->ctx_id)
603 || __put_user((void *)(unsigned long) req32.handle, 603 || __put_user((void *)(unsigned long)req32.handle,
604 &request->handle)) 604 &request->handle))
605 return -EFAULT; 605 return -EFAULT;
606 606
607 return drm_ioctl(file->f_dentry->d_inode, file, 607 return drm_ioctl(file->f_dentry->d_inode, file,
608 DRM_IOCTL_SET_SAREA_CTX, (unsigned long) request); 608 DRM_IOCTL_SET_SAREA_CTX, (unsigned long)request);
609} 609}
610 610
611static int compat_drm_getsareactx(struct file *file, unsigned int cmd, 611static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
@@ -628,20 +628,20 @@ static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
628 return -EFAULT; 628 return -EFAULT;
629 629
630 err = drm_ioctl(file->f_dentry->d_inode, file, 630 err = drm_ioctl(file->f_dentry->d_inode, file,
631 DRM_IOCTL_GET_SAREA_CTX, (unsigned long) request); 631 DRM_IOCTL_GET_SAREA_CTX, (unsigned long)request);
632 if (err) 632 if (err)
633 return err; 633 return err;
634 634
635 if (__get_user(handle, &request->handle) 635 if (__get_user(handle, &request->handle)
636 || __put_user((unsigned long) handle, &argp->handle)) 636 || __put_user((unsigned long)handle, &argp->handle))
637 return -EFAULT; 637 return -EFAULT;
638 638
639 return 0; 639 return 0;
640} 640}
641 641
642typedef struct drm_ctx_res32 { 642typedef struct drm_ctx_res32 {
643 int count; 643 int count;
644 u32 contexts; 644 u32 contexts;
645} drm_ctx_res32_t; 645} drm_ctx_res32_t;
646 646
647static int compat_drm_resctx(struct file *file, unsigned int cmd, 647static int compat_drm_resctx(struct file *file, unsigned int cmd,
@@ -659,12 +659,12 @@ static int compat_drm_resctx(struct file *file, unsigned int cmd,
659 if (!access_ok(VERIFY_WRITE, res, sizeof(*res))) 659 if (!access_ok(VERIFY_WRITE, res, sizeof(*res)))
660 return -EFAULT; 660 return -EFAULT;
661 if (__put_user(res32.count, &res->count) 661 if (__put_user(res32.count, &res->count)
662 || __put_user((drm_ctx_t __user *)(unsigned long) res32.contexts, 662 || __put_user((drm_ctx_t __user *) (unsigned long)res32.contexts,
663 &res->contexts)) 663 &res->contexts))
664 return -EFAULT; 664 return -EFAULT;
665 665
666 err = drm_ioctl(file->f_dentry->d_inode, file, 666 err = drm_ioctl(file->f_dentry->d_inode, file,
667 DRM_IOCTL_RES_CTX, (unsigned long) res); 667 DRM_IOCTL_RES_CTX, (unsigned long)res);
668 if (err) 668 if (err)
669 return err; 669 return err;
670 670
@@ -676,23 +676,23 @@ static int compat_drm_resctx(struct file *file, unsigned int cmd,
676} 676}
677 677
678typedef struct drm_dma32 { 678typedef struct drm_dma32 {
679 int context; /**< Context handle */ 679 int context; /**< Context handle */
680 int send_count; /**< Number of buffers to send */ 680 int send_count; /**< Number of buffers to send */
681 u32 send_indices; /**< List of handles to buffers */ 681 u32 send_indices; /**< List of handles to buffers */
682 u32 send_sizes; /**< Lengths of data to send */ 682 u32 send_sizes; /**< Lengths of data to send */
683 drm_dma_flags_t flags; /**< Flags */ 683 drm_dma_flags_t flags; /**< Flags */
684 int request_count; /**< Number of buffers requested */ 684 int request_count; /**< Number of buffers requested */
685 int request_size; /**< Desired size for buffers */ 685 int request_size; /**< Desired size for buffers */
686 u32 request_indices; /**< Buffer information */ 686 u32 request_indices; /**< Buffer information */
687 u32 request_sizes; 687 u32 request_sizes;
688 int granted_count; /**< Number of buffers granted */ 688 int granted_count; /**< Number of buffers granted */
689} drm_dma32_t; 689} drm_dma32_t;
690 690
691static int compat_drm_dma(struct file *file, unsigned int cmd, 691static int compat_drm_dma(struct file *file, unsigned int cmd,
692 unsigned long arg) 692 unsigned long arg)
693{ 693{
694 drm_dma32_t d32; 694 drm_dma32_t d32;
695 drm_dma32_t __user *argp = (void __user *) arg; 695 drm_dma32_t __user *argp = (void __user *)arg;
696 drm_dma_t __user *d; 696 drm_dma_t __user *d;
697 int err; 697 int err;
698 698
@@ -705,20 +705,20 @@ static int compat_drm_dma(struct file *file, unsigned int cmd,
705 705
706 if (__put_user(d32.context, &d->context) 706 if (__put_user(d32.context, &d->context)
707 || __put_user(d32.send_count, &d->send_count) 707 || __put_user(d32.send_count, &d->send_count)
708 || __put_user((int __user *)(unsigned long) d32.send_indices, 708 || __put_user((int __user *)(unsigned long)d32.send_indices,
709 &d->send_indices) 709 &d->send_indices)
710 || __put_user((int __user *)(unsigned long) d32.send_sizes, 710 || __put_user((int __user *)(unsigned long)d32.send_sizes,
711 &d->send_sizes) 711 &d->send_sizes)
712 || __put_user(d32.flags, &d->flags) 712 || __put_user(d32.flags, &d->flags)
713 || __put_user(d32.request_count, &d->request_count) 713 || __put_user(d32.request_count, &d->request_count)
714 || __put_user((int __user *)(unsigned long) d32.request_indices, 714 || __put_user((int __user *)(unsigned long)d32.request_indices,
715 &d->request_indices) 715 &d->request_indices)
716 || __put_user((int __user *)(unsigned long) d32.request_sizes, 716 || __put_user((int __user *)(unsigned long)d32.request_sizes,
717 &d->request_sizes)) 717 &d->request_sizes))
718 return -EFAULT; 718 return -EFAULT;
719 719
720 err = drm_ioctl(file->f_dentry->d_inode, file, 720 err = drm_ioctl(file->f_dentry->d_inode, file,
721 DRM_IOCTL_DMA, (unsigned long) d); 721 DRM_IOCTL_DMA, (unsigned long)d);
722 if (err) 722 if (err)
723 return err; 723 return err;
724 724
@@ -751,19 +751,19 @@ static int compat_drm_agp_enable(struct file *file, unsigned int cmd,
751 return -EFAULT; 751 return -EFAULT;
752 752
753 return drm_ioctl(file->f_dentry->d_inode, file, 753 return drm_ioctl(file->f_dentry->d_inode, file,
754 DRM_IOCTL_AGP_ENABLE, (unsigned long) mode); 754 DRM_IOCTL_AGP_ENABLE, (unsigned long)mode);
755} 755}
756 756
757typedef struct drm_agp_info32 { 757typedef struct drm_agp_info32 {
758 int agp_version_major; 758 int agp_version_major;
759 int agp_version_minor; 759 int agp_version_minor;
760 u32 mode; 760 u32 mode;
761 u32 aperture_base; /* physical address */ 761 u32 aperture_base; /* physical address */
762 u32 aperture_size; /* bytes */ 762 u32 aperture_size; /* bytes */
763 u32 memory_allowed; /* bytes */ 763 u32 memory_allowed; /* bytes */
764 u32 memory_used; 764 u32 memory_used;
765 765
766 /* PCI information */ 766 /* PCI information */
767 unsigned short id_vendor; 767 unsigned short id_vendor;
768 unsigned short id_device; 768 unsigned short id_device;
769} drm_agp_info32_t; 769} drm_agp_info32_t;
@@ -781,7 +781,7 @@ static int compat_drm_agp_info(struct file *file, unsigned int cmd,
781 return -EFAULT; 781 return -EFAULT;
782 782
783 err = drm_ioctl(file->f_dentry->d_inode, file, 783 err = drm_ioctl(file->f_dentry->d_inode, file,
784 DRM_IOCTL_AGP_INFO, (unsigned long) info); 784 DRM_IOCTL_AGP_INFO, (unsigned long)info);
785 if (err) 785 if (err)
786 return err; 786 return err;
787 787
@@ -806,7 +806,7 @@ typedef struct drm_agp_buffer32 {
806 u32 size; /**< In bytes -- will round to page boundary */ 806 u32 size; /**< In bytes -- will round to page boundary */
807 u32 handle; /**< Used for binding / unbinding */ 807 u32 handle; /**< Used for binding / unbinding */
808 u32 type; /**< Type of memory to allocate */ 808 u32 type; /**< Type of memory to allocate */
809 u32 physical; /**< Physical used by i810 */ 809 u32 physical; /**< Physical used by i810 */
810} drm_agp_buffer32_t; 810} drm_agp_buffer32_t;
811 811
812static int compat_drm_agp_alloc(struct file *file, unsigned int cmd, 812static int compat_drm_agp_alloc(struct file *file, unsigned int cmd,
@@ -827,7 +827,7 @@ static int compat_drm_agp_alloc(struct file *file, unsigned int cmd,
827 return -EFAULT; 827 return -EFAULT;
828 828
829 err = drm_ioctl(file->f_dentry->d_inode, file, 829 err = drm_ioctl(file->f_dentry->d_inode, file,
830 DRM_IOCTL_AGP_ALLOC, (unsigned long) request); 830 DRM_IOCTL_AGP_ALLOC, (unsigned long)request);
831 if (err) 831 if (err)
832 return err; 832 return err;
833 833
@@ -835,7 +835,7 @@ static int compat_drm_agp_alloc(struct file *file, unsigned int cmd,
835 || __get_user(req32.physical, &request->physical) 835 || __get_user(req32.physical, &request->physical)
836 || copy_to_user(argp, &req32, sizeof(req32))) { 836 || copy_to_user(argp, &req32, sizeof(req32))) {
837 drm_ioctl(file->f_dentry->d_inode, file, 837 drm_ioctl(file->f_dentry->d_inode, file,
838 DRM_IOCTL_AGP_FREE, (unsigned long) request); 838 DRM_IOCTL_AGP_FREE, (unsigned long)request);
839 return -EFAULT; 839 return -EFAULT;
840 } 840 }
841 841
@@ -856,7 +856,7 @@ static int compat_drm_agp_free(struct file *file, unsigned int cmd,
856 return -EFAULT; 856 return -EFAULT;
857 857
858 return drm_ioctl(file->f_dentry->d_inode, file, 858 return drm_ioctl(file->f_dentry->d_inode, file,
859 DRM_IOCTL_AGP_FREE, (unsigned long) request); 859 DRM_IOCTL_AGP_FREE, (unsigned long)request);
860} 860}
861 861
862typedef struct drm_agp_binding32 { 862typedef struct drm_agp_binding32 {
@@ -881,7 +881,7 @@ static int compat_drm_agp_bind(struct file *file, unsigned int cmd,
881 return -EFAULT; 881 return -EFAULT;
882 882
883 return drm_ioctl(file->f_dentry->d_inode, file, 883 return drm_ioctl(file->f_dentry->d_inode, file,
884 DRM_IOCTL_AGP_BIND, (unsigned long) request); 884 DRM_IOCTL_AGP_BIND, (unsigned long)request);
885} 885}
886 886
887static int compat_drm_agp_unbind(struct file *file, unsigned int cmd, 887static int compat_drm_agp_unbind(struct file *file, unsigned int cmd,
@@ -898,9 +898,9 @@ static int compat_drm_agp_unbind(struct file *file, unsigned int cmd,
898 return -EFAULT; 898 return -EFAULT;
899 899
900 return drm_ioctl(file->f_dentry->d_inode, file, 900 return drm_ioctl(file->f_dentry->d_inode, file,
901 DRM_IOCTL_AGP_UNBIND, (unsigned long) request); 901 DRM_IOCTL_AGP_UNBIND, (unsigned long)request);
902} 902}
903#endif /* __OS_HAS_AGP */ 903#endif /* __OS_HAS_AGP */
904 904
905typedef struct drm_scatter_gather32 { 905typedef struct drm_scatter_gather32 {
906 u32 size; /**< In bytes -- will round to page boundary */ 906 u32 size; /**< In bytes -- will round to page boundary */
@@ -923,7 +923,7 @@ static int compat_drm_sg_alloc(struct file *file, unsigned int cmd,
923 return -EFAULT; 923 return -EFAULT;
924 924
925 err = drm_ioctl(file->f_dentry->d_inode, file, 925 err = drm_ioctl(file->f_dentry->d_inode, file,
926 DRM_IOCTL_SG_ALLOC, (unsigned long) request); 926 DRM_IOCTL_SG_ALLOC, (unsigned long)request);
927 if (err) 927 if (err)
928 return err; 928 return err;
929 929
@@ -950,7 +950,7 @@ static int compat_drm_sg_free(struct file *file, unsigned int cmd,
950 return -EFAULT; 950 return -EFAULT;
951 951
952 return drm_ioctl(file->f_dentry->d_inode, file, 952 return drm_ioctl(file->f_dentry->d_inode, file,
953 DRM_IOCTL_SG_FREE, (unsigned long) request); 953 DRM_IOCTL_SG_FREE, (unsigned long)request);
954} 954}
955 955
956struct drm_wait_vblank_request32 { 956struct drm_wait_vblank_request32 {
@@ -990,7 +990,7 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd,
990 return -EFAULT; 990 return -EFAULT;
991 991
992 err = drm_ioctl(file->f_dentry->d_inode, file, 992 err = drm_ioctl(file->f_dentry->d_inode, file,
993 DRM_IOCTL_WAIT_VBLANK, (unsigned long) request); 993 DRM_IOCTL_WAIT_VBLANK, (unsigned long)request);
994 if (err) 994 if (err)
995 return err; 995 return err;
996 996
@@ -1059,11 +1059,12 @@ long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
1059 1059
1060 lock_kernel(); /* XXX for now */ 1060 lock_kernel(); /* XXX for now */
1061 if (fn != NULL) 1061 if (fn != NULL)
1062 ret = (*fn)(filp, cmd, arg); 1062 ret = (*fn) (filp, cmd, arg);
1063 else 1063 else
1064 ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg); 1064 ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
1065 unlock_kernel(); 1065 unlock_kernel();
1066 1066
1067 return ret; 1067 return ret;
1068} 1068}
1069
1069EXPORT_SYMBOL(drm_compat_ioctl); 1070EXPORT_SYMBOL(drm_compat_ioctl);