aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2006-08-07 06:07:43 -0400
committerDave Airlie <airlied@linux.ie>2006-09-21 15:32:30 -0400
commit3d77461ecd7fb92bb888f69478e3518b3c947ce3 (patch)
tree8f5c01d7d50873e9361aa50a070f633bb77f838c /drivers/char
parente478bec0ba0a83a48a0f6982934b6de079e7e6b3 (diff)
drm: cleanup old compat code and DRM fns from Linux only code
This patch removes some of the old compatibility macros from the DRM, and removes use of DRM wrappers from Linux specific code. Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/drm/drmP.h12
-rw-r--r--drivers/char/drm/drm_drv.c2
-rw-r--r--drivers/char/drm/drm_fops.c2
-rw-r--r--drivers/char/drm/drm_ioc32.c2
-rw-r--r--drivers/char/drm/drm_ioctl.c8
-rw-r--r--drivers/char/drm/drm_irq.c6
-rw-r--r--drivers/char/drm/drm_proc.c2
-rw-r--r--drivers/char/drm/drm_vm.c12
-rw-r--r--drivers/char/drm/i810_dma.c2
-rw-r--r--drivers/char/drm/i830_dma.c2
10 files changed, 21 insertions, 29 deletions
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index d2a56182bc35..cccfdb720e96 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -141,16 +141,6 @@
141/*@}*/ 141/*@}*/
142 142
143/***********************************************************************/ 143/***********************************************************************/
144/** \name Backward compatibility section */
145/*@{*/
146
147#define DRM_RPR_ARG(vma) vma,
148
149#define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT)
150
151/*@}*/
152
153/***********************************************************************/
154/** \name Macros to make printk easier */ 144/** \name Macros to make printk easier */
155/*@{*/ 145/*@{*/
156 146
@@ -211,8 +201,6 @@
211/*@{*/ 201/*@{*/
212 202
213#define DRM_ARRAY_SIZE(x) ARRAY_SIZE(x) 203#define DRM_ARRAY_SIZE(x) ARRAY_SIZE(x)
214#define DRM_MIN(a,b) min(a,b)
215#define DRM_MAX(a,b) max(a,b)
216 204
217#define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1)) 205#define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1))
218#define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) 206#define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x))
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c
index 3c0b882a8e72..3da72f7364f0 100644
--- a/drivers/char/drm/drm_drv.c
+++ b/drivers/char/drm/drm_drv.c
@@ -118,7 +118,7 @@ static drm_ioctl_desc_t drm_ioctls[] = {
118 [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)] = {drm_wait_vblank, 0}, 118 [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)] = {drm_wait_vblank, 0},
119}; 119};
120 120
121#define DRIVER_IOCTL_COUNT DRM_ARRAY_SIZE( drm_ioctls ) 121#define DRIVER_IOCTL_COUNT ARRAY_SIZE( drm_ioctls )
122 122
123/** 123/**
124 * Take down the DRM device. 124 * Take down the DRM device.
diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c
index b7f7951c4587..51ccc82bf612 100644
--- a/drivers/char/drm/drm_fops.c
+++ b/drivers/char/drm/drm_fops.c
@@ -69,7 +69,7 @@ static int drm_setup(drm_device_t * dev)
69 return i; 69 return i;
70 } 70 }
71 71
72 for (i = 0; i < DRM_ARRAY_SIZE(dev->counts); i++) 72 for (i = 0; i < ARRAY_SIZE(dev->counts); i++)
73 atomic_set(&dev->counts[i], 0); 73 atomic_set(&dev->counts[i], 0);
74 74
75 for (i = 0; i < DRM_HASH_SIZE; i++) { 75 for (i = 0; i < DRM_HASH_SIZE; i++) {
diff --git a/drivers/char/drm/drm_ioc32.c b/drivers/char/drm/drm_ioc32.c
index e9e2db18952d..d4f874520082 100644
--- a/drivers/char/drm/drm_ioc32.c
+++ b/drivers/char/drm/drm_ioc32.c
@@ -1051,7 +1051,7 @@ long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
1051 drm_ioctl_compat_t *fn; 1051 drm_ioctl_compat_t *fn;
1052 int ret; 1052 int ret;
1053 1053
1054 if (nr >= DRM_ARRAY_SIZE(drm_compat_ioctls)) 1054 if (nr >= ARRAY_SIZE(drm_compat_ioctls))
1055 return -ENOTTY; 1055 return -ENOTTY;
1056 1056
1057 fn = drm_compat_ioctls[nr]; 1057 fn = drm_compat_ioctls[nr];
diff --git a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c
index 555f323b8a32..31dfe83141ea 100644
--- a/drivers/char/drm/drm_ioctl.c
+++ b/drivers/char/drm/drm_ioctl.c
@@ -331,21 +331,23 @@ int drm_setversion(DRM_IOCTL_ARGS)
331 int if_version; 331 int if_version;
332 drm_set_version_t __user *argp = (void __user *)data; 332 drm_set_version_t __user *argp = (void __user *)data;
333 333
334 DRM_COPY_FROM_USER_IOCTL(sv, argp, sizeof(sv)); 334 if (copy_from_user(&sv, argp, sizeof(sv)))
335 return -EFAULT;
335 336
336 retv.drm_di_major = DRM_IF_MAJOR; 337 retv.drm_di_major = DRM_IF_MAJOR;
337 retv.drm_di_minor = DRM_IF_MINOR; 338 retv.drm_di_minor = DRM_IF_MINOR;
338 retv.drm_dd_major = dev->driver->major; 339 retv.drm_dd_major = dev->driver->major;
339 retv.drm_dd_minor = dev->driver->minor; 340 retv.drm_dd_minor = dev->driver->minor;
340 341
341 DRM_COPY_TO_USER_IOCTL(argp, retv, sizeof(sv)); 342 if (copy_to_user(argp, &retv, sizeof(sv)))
343 return -EFAULT;
342 344
343 if (sv.drm_di_major != -1) { 345 if (sv.drm_di_major != -1) {
344 if (sv.drm_di_major != DRM_IF_MAJOR || 346 if (sv.drm_di_major != DRM_IF_MAJOR ||
345 sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR) 347 sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR)
346 return EINVAL; 348 return EINVAL;
347 if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_di_minor); 349 if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_di_minor);
348 dev->if_version = DRM_MAX(if_version, dev->if_version); 350 dev->if_version = max(if_version, dev->if_version);
349 if (sv.drm_di_minor >= 1) { 351 if (sv.drm_di_minor >= 1) {
350 /* 352 /*
351 * Version 1.1 includes tying of DRM to specific device 353 * Version 1.1 includes tying of DRM to specific device
diff --git a/drivers/char/drm/drm_irq.c b/drivers/char/drm/drm_irq.c
index ebdb7182c4fd..8e484d23e12b 100644
--- a/drivers/char/drm/drm_irq.c
+++ b/drivers/char/drm/drm_irq.c
@@ -255,7 +255,8 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
255 if (!dev->irq) 255 if (!dev->irq)
256 return -EINVAL; 256 return -EINVAL;
257 257
258 DRM_COPY_FROM_USER_IOCTL(vblwait, argp, sizeof(vblwait)); 258 if (copy_from_user(&vblwait, argp, sizeof(vblwait)))
259 return -EFAULT;
259 260
260 switch (vblwait.request.type & ~_DRM_VBLANK_FLAGS_MASK) { 261 switch (vblwait.request.type & ~_DRM_VBLANK_FLAGS_MASK) {
261 case _DRM_VBLANK_RELATIVE: 262 case _DRM_VBLANK_RELATIVE:
@@ -329,7 +330,8 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
329 } 330 }
330 331
331 done: 332 done:
332 DRM_COPY_TO_USER_IOCTL(argp, vblwait, sizeof(vblwait)); 333 if (copy_to_user(argp, &vblwait, sizeof(vblwait)))
334 return -EFAULT;
333 335
334 return ret; 336 return ret;
335} 337}
diff --git a/drivers/char/drm/drm_proc.c b/drivers/char/drm/drm_proc.c
index 362a270af0f1..62d5fe15f046 100644
--- a/drivers/char/drm/drm_proc.c
+++ b/drivers/char/drm/drm_proc.c
@@ -510,7 +510,7 @@ static int drm__vma_info(char *buf, char **start, off_t offset, int request,
510 vma->vm_flags & VM_MAYSHARE ? 's' : 'p', 510 vma->vm_flags & VM_MAYSHARE ? 's' : 'p',
511 vma->vm_flags & VM_LOCKED ? 'l' : '-', 511 vma->vm_flags & VM_LOCKED ? 'l' : '-',
512 vma->vm_flags & VM_IO ? 'i' : '-', 512 vma->vm_flags & VM_IO ? 'i' : '-',
513 VM_OFFSET(vma)); 513 vma->vm_pgoff << PAGE_SHIFT);
514 514
515#if defined(__i386__) 515#if defined(__i386__)
516 pgprot = pgprot_val(vma->vm_page_prot); 516 pgprot = pgprot_val(vma->vm_page_prot);
diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c
index ffd0800ed601..afb4f0a44b81 100644
--- a/drivers/char/drm/drm_vm.c
+++ b/drivers/char/drm/drm_vm.c
@@ -75,7 +75,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
75 map = r_list->map; 75 map = r_list->map;
76 if (!map) 76 if (!map)
77 continue; 77 continue;
78 if (r_list->user_token == VM_OFFSET(vma)) 78 if (r_list->user_token == (vma->vm_pgoff << PAGE_SHIFT))
79 break; 79 break;
80 } 80 }
81 81
@@ -467,7 +467,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
467 dev = priv->head->dev; 467 dev = priv->head->dev;
468 dma = dev->dma; 468 dma = dev->dma;
469 DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", 469 DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
470 vma->vm_start, vma->vm_end, VM_OFFSET(vma)); 470 vma->vm_start, vma->vm_end, vma->vm_pgoff << PAGE_SHIFT);
471 471
472 /* Length must match exact page count */ 472 /* Length must match exact page count */
473 if (!dma || (length >> PAGE_SHIFT) != dma->page_count) { 473 if (!dma || (length >> PAGE_SHIFT) != dma->page_count) {
@@ -526,7 +526,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
526 struct list_head *list; 526 struct list_head *list;
527 527
528 DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", 528 DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
529 vma->vm_start, vma->vm_end, VM_OFFSET(vma)); 529 vma->vm_start, vma->vm_end, vma->vm_pgoff << PAGE_SHIFT);
530 530
531 if (!priv->authenticated) 531 if (!priv->authenticated)
532 return -EACCES; 532 return -EACCES;
@@ -535,7 +535,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
535 * the AGP mapped at physical address 0 535 * the AGP mapped at physical address 0
536 * --BenH. 536 * --BenH.
537 */ 537 */
538 if (!VM_OFFSET(vma) 538 if (!(vma->vm_pgoff << PAGE_SHIFT)
539#if __OS_HAS_AGP 539#if __OS_HAS_AGP
540 && (!dev->agp 540 && (!dev->agp
541 || dev->agp->agp_info.device->vendor != PCI_VENDOR_ID_APPLE) 541 || dev->agp->agp_info.device->vendor != PCI_VENDOR_ID_APPLE)
@@ -556,7 +556,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
556 map = r_list->map; 556 map = r_list->map;
557 if (!map) 557 if (!map)
558 continue; 558 continue;
559 if (r_list->user_token == VM_OFFSET(vma)) 559 if (r_list->user_token == vma->vm_pgoff << PAGE_SHIFT)
560 break; 560 break;
561 } 561 }
562 562
@@ -620,7 +620,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
620 offset = dev->driver->get_reg_ofs(dev); 620 offset = dev->driver->get_reg_ofs(dev);
621#ifdef __sparc__ 621#ifdef __sparc__
622 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 622 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
623 if (io_remap_pfn_range(DRM_RPR_ARG(vma) vma->vm_start, 623 if (io_remap_pfn_range(vma, vma->vm_start,
624 (map->offset + offset) >> PAGE_SHIFT, 624 (map->offset + offset) >> PAGE_SHIFT,
625 vma->vm_end - vma->vm_start, 625 vma->vm_end - vma->vm_start,
626 vma->vm_page_prot)) 626 vma->vm_page_prot))
diff --git a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c
index c658dde3633b..28ee6e3f1d99 100644
--- a/drivers/char/drm/i810_dma.c
+++ b/drivers/char/drm/i810_dma.c
@@ -106,7 +106,7 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
106 unlock_kernel(); 106 unlock_kernel();
107 107
108 if (io_remap_pfn_range(vma, vma->vm_start, 108 if (io_remap_pfn_range(vma, vma->vm_start,
109 VM_OFFSET(vma) >> PAGE_SHIFT, 109 vma->vm_pgoff,
110 vma->vm_end - vma->vm_start, vma->vm_page_prot)) 110 vma->vm_end - vma->vm_start, vma->vm_page_prot))
111 return -EAGAIN; 111 return -EAGAIN;
112 return 0; 112 return 0;
diff --git a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c
index b0f815d8cea8..2cf3cc59ac64 100644
--- a/drivers/char/drm/i830_dma.c
+++ b/drivers/char/drm/i830_dma.c
@@ -108,7 +108,7 @@ static int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
108 unlock_kernel(); 108 unlock_kernel();
109 109
110 if (io_remap_pfn_range(vma, vma->vm_start, 110 if (io_remap_pfn_range(vma, vma->vm_start,
111 VM_OFFSET(vma) >> PAGE_SHIFT, 111 vma->vm_pgoff,
112 vma->vm_end - vma->vm_start, vma->vm_page_prot)) 112 vma->vm_end - vma->vm_start, vma->vm_page_prot))
113 return -EAGAIN; 113 return -EAGAIN;
114 return 0; 114 return 0;