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>
This commit is contained in:
parent
e478bec0ba
commit
3d77461ecd
|
@ -140,16 +140,6 @@
|
|||
|
||||
/*@}*/
|
||||
|
||||
/***********************************************************************/
|
||||
/** \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 */
|
||||
/*@{*/
|
||||
|
@ -211,8 +201,6 @@
|
|||
/*@{*/
|
||||
|
||||
#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))
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue