]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
drm: cleanup old compat code and DRM fns from Linux only code
authorDave Airlie <airlied@linux.ie>
Mon, 7 Aug 2006 10:07:43 +0000 (20:07 +1000)
committerDave Airlie <airlied@linux.ie>
Thu, 21 Sep 2006 19:32:30 +0000 (05:32 +1000)
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>
drivers/char/drm/drmP.h
drivers/char/drm/drm_drv.c
drivers/char/drm/drm_fops.c
drivers/char/drm/drm_ioc32.c
drivers/char/drm/drm_ioctl.c
drivers/char/drm/drm_irq.c
drivers/char/drm/drm_proc.c
drivers/char/drm/drm_vm.c
drivers/char/drm/i810_dma.c
drivers/char/drm/i830_dma.c

index d2a56182bc35786a08c681abb273fea450e3abdd..cccfdb720e968429115c214e154cadb3210f306b 100644 (file)
 
 /*@}*/
 
-/***********************************************************************/
-/** \name Backward compatibility section */
-/*@{*/
-
-#define DRM_RPR_ARG(vma) vma,
-
-#define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT)
-
-/*@}*/
-
 /***********************************************************************/
 /** \name Macros to make printk easier */
 /*@{*/
 /*@{*/
 
 #define DRM_ARRAY_SIZE(x) ARRAY_SIZE(x)
-#define DRM_MIN(a,b) min(a,b)
-#define DRM_MAX(a,b) max(a,b)
 
 #define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1))
 #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x))
index 3c0b882a8e72843a2074b2b495ffa2f2ebf266ab..3da72f7364f00c52eae0c362532420470e1668d1 100644 (file)
@@ -118,7 +118,7 @@ static drm_ioctl_desc_t drm_ioctls[] = {
        [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)] = {drm_wait_vblank, 0},
 };
 
-#define DRIVER_IOCTL_COUNT     DRM_ARRAY_SIZE( drm_ioctls )
+#define DRIVER_IOCTL_COUNT     ARRAY_SIZE( drm_ioctls )
 
 /**
  * Take down the DRM device.
index b7f7951c458721d8b3517c49dd5b4531bfa6f3be..51ccc82bf612dacd2ec95e753dcaafffea6815ab 100644 (file)
@@ -69,7 +69,7 @@ static int drm_setup(drm_device_t * dev)
                        return i;
        }
 
-       for (i = 0; i < DRM_ARRAY_SIZE(dev->counts); i++)
+       for (i = 0; i < ARRAY_SIZE(dev->counts); i++)
                atomic_set(&dev->counts[i], 0);
 
        for (i = 0; i < DRM_HASH_SIZE; i++) {
index e9e2db18952dc91e2b88c8283efb6d385ff84dd9..d4f874520082844776eff9f912cb70323f25003f 100644 (file)
@@ -1051,7 +1051,7 @@ long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
        drm_ioctl_compat_t *fn;
        int ret;
 
-       if (nr >= DRM_ARRAY_SIZE(drm_compat_ioctls))
+       if (nr >= ARRAY_SIZE(drm_compat_ioctls))
                return -ENOTTY;
 
        fn = drm_compat_ioctls[nr];
index 555f323b8a32c350578b4f75ea04b5a345472c80..31dfe83141ea2c16b3b4e2a71e043d5fccf92c8c 100644 (file)
@@ -331,21 +331,23 @@ int drm_setversion(DRM_IOCTL_ARGS)
        int if_version;
        drm_set_version_t __user *argp = (void __user *)data;
 
-       DRM_COPY_FROM_USER_IOCTL(sv, argp, sizeof(sv));
+       if (copy_from_user(&sv, argp, sizeof(sv)))
+               return -EFAULT;
 
        retv.drm_di_major = DRM_IF_MAJOR;
        retv.drm_di_minor = DRM_IF_MINOR;
        retv.drm_dd_major = dev->driver->major;
        retv.drm_dd_minor = dev->driver->minor;
 
-       DRM_COPY_TO_USER_IOCTL(argp, retv, sizeof(sv));
+       if (copy_to_user(argp, &retv, sizeof(sv)))
+               return -EFAULT;
 
        if (sv.drm_di_major != -1) {
                if (sv.drm_di_major != DRM_IF_MAJOR ||
                    sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR)
                        return EINVAL;
                if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_di_minor);
-               dev->if_version = DRM_MAX(if_version, dev->if_version);
+               dev->if_version = max(if_version, dev->if_version);
                if (sv.drm_di_minor >= 1) {
                        /*
                         * Version 1.1 includes tying of DRM to specific device
index ebdb7182c4fd7e2c973d27a5aaa602861058c960..8e484d23e12b2a16ece8727521912cf9f830de3e 100644 (file)
@@ -255,7 +255,8 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
        if (!dev->irq)
                return -EINVAL;
 
-       DRM_COPY_FROM_USER_IOCTL(vblwait, argp, sizeof(vblwait));
+       if (copy_from_user(&vblwait, argp, sizeof(vblwait)))
+               return -EFAULT;
 
        switch (vblwait.request.type & ~_DRM_VBLANK_FLAGS_MASK) {
        case _DRM_VBLANK_RELATIVE:
@@ -329,7 +330,8 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
        }
 
       done:
-       DRM_COPY_TO_USER_IOCTL(argp, vblwait, sizeof(vblwait));
+       if (copy_to_user(argp, &vblwait, sizeof(vblwait)))
+               return -EFAULT;
 
        return ret;
 }
index 362a270af0f10c53387069b2b7124ce788f23e96..62d5fe15f0468971b9017c1b932c3c1fcd5be819 100644 (file)
@@ -510,7 +510,7 @@ static int drm__vma_info(char *buf, char **start, off_t offset, int request,
                               vma->vm_flags & VM_MAYSHARE ? 's' : 'p',
                               vma->vm_flags & VM_LOCKED ? 'l' : '-',
                               vma->vm_flags & VM_IO ? 'i' : '-',
-                              VM_OFFSET(vma));
+                              vma->vm_pgoff << PAGE_SHIFT);
 
 #if defined(__i386__)
                pgprot = pgprot_val(vma->vm_page_prot);
index ffd0800ed601b286863f5a3a80c2538042340af1..afb4f0a44b8182d0d2540ce0ebf9e413660ce5a3 100644 (file)
@@ -75,7 +75,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
                map = r_list->map;
                if (!map)
                        continue;
-               if (r_list->user_token == VM_OFFSET(vma))
+               if (r_list->user_token == (vma->vm_pgoff << PAGE_SHIFT))
                        break;
        }
 
@@ -467,7 +467,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
        dev = priv->head->dev;
        dma = dev->dma;
        DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
-                 vma->vm_start, vma->vm_end, VM_OFFSET(vma));
+                 vma->vm_start, vma->vm_end, vma->vm_pgoff << PAGE_SHIFT);
 
        /* Length must match exact page count */
        if (!dma || (length >> PAGE_SHIFT) != dma->page_count) {
@@ -526,7 +526,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
        struct list_head *list;
 
        DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
-                 vma->vm_start, vma->vm_end, VM_OFFSET(vma));
+                 vma->vm_start, vma->vm_end, vma->vm_pgoff << PAGE_SHIFT);
 
        if (!priv->authenticated)
                return -EACCES;
@@ -535,7 +535,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
         * the AGP mapped at physical address 0
         * --BenH.
         */
-       if (!VM_OFFSET(vma)
+       if (!(vma->vm_pgoff << PAGE_SHIFT)
 #if __OS_HAS_AGP
            && (!dev->agp
                || 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)
                map = r_list->map;
                if (!map)
                        continue;
-               if (r_list->user_token == VM_OFFSET(vma))
+               if (r_list->user_token == vma->vm_pgoff << PAGE_SHIFT)
                        break;
        }
 
@@ -620,7 +620,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
                offset = dev->driver->get_reg_ofs(dev);
 #ifdef __sparc__
                vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-               if (io_remap_pfn_range(DRM_RPR_ARG(vma) vma->vm_start,
+               if (io_remap_pfn_range(vma, vma->vm_start,
                                       (map->offset + offset) >> PAGE_SHIFT,
                                       vma->vm_end - vma->vm_start,
                                       vma->vm_page_prot))
index c658dde3633b4307b4e38d79eafdf079ab56af0d..28ee6e3f1d99d3a55c60ed0686e9b3f82a7920cb 100644 (file)
@@ -106,7 +106,7 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
        unlock_kernel();
 
        if (io_remap_pfn_range(vma, vma->vm_start,
-                              VM_OFFSET(vma) >> PAGE_SHIFT,
+                              vma->vm_pgoff,
                               vma->vm_end - vma->vm_start, vma->vm_page_prot))
                return -EAGAIN;
        return 0;
index b0f815d8cea8592028cee0540f6b23ffe3dac9c8..2cf3cc59ac64ede6928f8038e1bb80831b33a021 100644 (file)
@@ -108,7 +108,7 @@ static int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
        unlock_kernel();
 
        if (io_remap_pfn_range(vma, vma->vm_start,
-                              VM_OFFSET(vma) >> PAGE_SHIFT,
+                              vma->vm_pgoff,
                               vma->vm_end - vma->vm_start, vma->vm_page_prot))
                return -EAGAIN;
        return 0;