summaryrefslogtreecommitdiff
path: root/linux-core/drm_vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core/drm_vm.c')
-rw-r--r--linux-core/drm_vm.c88
1 files changed, 0 insertions, 88 deletions
diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c
index d9ee0ff4..43ef500a 100644
--- a/linux-core/drm_vm.c
+++ b/linux-core/drm_vm.c
@@ -56,16 +56,9 @@ struct vm_operations_struct DRM(vm_sg_ops) = {
close: DRM(vm_close),
};
-#if LINUX_VERSION_CODE < 0x020317
-unsigned long DRM(vm_nopage)(struct vm_area_struct *vma,
- unsigned long address,
- int write_access)
-#else
- /* Return type changed in 2.3.23 */
struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
unsigned long address,
int write_access)
-#endif
{
#if defined(__alpha__) && __REALLY_HAVE_AGP
drm_file_t *priv = vma->vm_file->private_data;
@@ -122,32 +115,17 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
baddr, __va(agpmem->memory->memory[offset]), offset);
#endif
get_page(page);
-#if LINUX_VERSION_CODE < 0x020317
- return page_address(page);
-#else
return page;
-#endif
}
#endif
return NOPAGE_SIGBUS; /* Disallow mremap */
}
-#if LINUX_VERSION_CODE < 0x020317
-unsigned long DRM(vm_shm_nopage)(struct vm_area_struct *vma,
- unsigned long address,
- int write_access)
-#else
- /* Return type changed in 2.3.23 */
struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
unsigned long address,
int write_access)
-#endif
{
-#if LINUX_VERSION_CODE >= 0x020300
drm_map_t *map = (drm_map_t *)vma->vm_private_data;
-#else
- drm_map_t *map = (drm_map_t *)vma->vm_pte;
-#endif
unsigned long offset;
unsigned long i;
pgd_t *pgd;
@@ -174,11 +152,7 @@ struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
get_page(page);
DRM_DEBUG("0x%08lx => 0x%08x\n", address, page_to_bus(page));
-#if LINUX_VERSION_CODE < 0x020317
- return page_address(page);
-#else
return page;
-#endif
}
/* Special close routine which deletes map information if we are the last
@@ -197,25 +171,14 @@ void DRM(vm_shm_close)(struct vm_area_struct *vma)
DRM_DEBUG("0x%08lx,0x%08lx\n",
vma->vm_start, vma->vm_end - vma->vm_start);
-#if LINUX_VERSION_CODE < 0x020333
- MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
-#endif
atomic_dec(&dev->vma_count);
-#if LINUX_VERSION_CODE >= 0x020300
map = vma->vm_private_data;
-#else
- map = vma->vm_pte;
-#endif
down(&dev->struct_sem);
for (pt = dev->vmalist, prev = NULL; pt; pt = next) {
next = pt->next;
-#if LINUX_VERSION_CODE >= 0x020300
if (pt->vma->vm_private_data == map) found_maps++;
-#else
- if (pt->vma->vm_pte == map) found_maps++;
-#endif
if (pt->vma == vma) {
if (prev) {
prev->next = pt->next;
@@ -268,16 +231,9 @@ void DRM(vm_shm_close)(struct vm_area_struct *vma)
up(&dev->struct_sem);
}
-#if LINUX_VERSION_CODE < 0x020317
-unsigned long DRM(vm_dma_nopage)(struct vm_area_struct *vma,
- unsigned long address,
- int write_access)
-#else
- /* Return type changed in 2.3.23 */
struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
unsigned long address,
int write_access)
-#endif
{
drm_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->dev;
@@ -299,29 +255,14 @@ struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
DRM_DEBUG("0x%08lx (page %lu) => 0x%08x\n", address, page_nr,
page_to_bus(page));
-#if LINUX_VERSION_CODE < 0x020317
- return page_address(page);
-#else
return page;
-#endif
}
-#if LINUX_VERSION_CODE < 0x020317
-unsigned long DRM(vm_sg_nopage)(struct vm_area_struct *vma,
- unsigned long address,
- int write_access)
-#else
- /* Return type changed in 2.3.23 */
struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
unsigned long address,
int write_access)
-#endif
{
-#if LINUX_VERSION_CODE >= 0x020300
drm_map_t *map = (drm_map_t *)vma->vm_private_data;
-#else
- drm_map_t *map = (drm_map_t *)vma->vm_pte;
-#endif
drm_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->dev;
drm_sg_mem_t *entry = dev->sg;
@@ -341,11 +282,7 @@ struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
page = entry->pagelist[page_offset];
get_page(page);
-#if LINUX_VERSION_CODE < 0x020317
- return page_address(page);
-#else
return page;
-#endif
}
void DRM(vm_open)(struct vm_area_struct *vma)
@@ -357,10 +294,6 @@ void DRM(vm_open)(struct vm_area_struct *vma)
DRM_DEBUG("0x%08lx,0x%08lx\n",
vma->vm_start, vma->vm_end - vma->vm_start);
atomic_inc(&dev->vma_count);
-#if LINUX_VERSION_CODE < 0x020333
- /* The map can exist after the fd is closed. */
- MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
-#endif
vma_entry = DRM(alloc)(sizeof(*vma_entry), DRM_MEM_VMAS);
if (vma_entry) {
@@ -381,9 +314,6 @@ void DRM(vm_close)(struct vm_area_struct *vma)
DRM_DEBUG("0x%08lx,0x%08lx\n",
vma->vm_start, vma->vm_end - vma->vm_start);
-#if LINUX_VERSION_CODE < 0x020333
- MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
-#endif
atomic_dec(&dev->vma_count);
down(&dev->struct_sem);
@@ -424,11 +354,6 @@ int DRM(mmap_dma)(struct file *filp, struct vm_area_struct *vma)
vma->vm_ops = &DRM(vm_dma_ops);
vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
-#if LINUX_VERSION_CODE < 0x020203 /* KERNEL_VERSION(2,2,3) */
- /* In Linux 2.2.3 and above, this is
- handled in do_mmap() in mm/mmap.c. */
- ++filp->f_count;
-#endif
vma->vm_file = filp; /* Needed for drm_vm_open() */
DRM(vm_open)(vma);
return 0;
@@ -543,22 +468,14 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma)
break;
case _DRM_SHM:
vma->vm_ops = &DRM(vm_shm_ops);
-#if LINUX_VERSION_CODE >= 0x020300
vma->vm_private_data = (void *)map;
-#else
- vma->vm_pte = (unsigned long)map;
-#endif
/* Don't let this area swap. Change when
DRM_KERNEL advisory is supported. */
vma->vm_flags |= VM_LOCKED;
break;
case _DRM_SCATTER_GATHER:
vma->vm_ops = &DRM(vm_sg_ops);
-#if LINUX_VERSION_CODE >= 0x020300
vma->vm_private_data = (void *)map;
-#else
- vma->vm_pte = (unsigned long)map;
-#endif
vma->vm_flags |= VM_LOCKED;
break;
default:
@@ -566,11 +483,6 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma)
}
vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
-#if LINUX_VERSION_CODE < 0x020203 /* KERNEL_VERSION(2,2,3) */
- /* In Linux 2.2.3 and above, this is
- handled in do_mmap() in mm/mmap.c. */
- ++filp->f_count;
-#endif
vma->vm_file = filp; /* Needed for drm_vm_open() */
DRM(vm_open)(vma);
return 0;