aboutsummaryrefslogtreecommitdiff
path: root/linux-core/i830_dma.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2002-05-16 23:47:15 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2002-05-16 23:47:15 +0000
commit9e67da5626b683df58f2041fdb0f743eb4da7036 (patch)
tree899477e18e99e9b620e27961de58c0664b218825 /linux-core/i830_dma.c
parent3903e5ac94c07cf31f0bc24eff5011ef8cc7afba (diff)
Allow drm to build under 2.4 and 2.5(.14)
Diffstat (limited to 'linux-core/i830_dma.c')
-rw-r--r--linux-core/i830_dma.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/linux-core/i830_dma.c b/linux-core/i830_dma.c
index fbdc9523..a2b39ee0 100644
--- a/linux-core/i830_dma.c
+++ b/linux-core/i830_dma.c
@@ -183,7 +183,7 @@ int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
buf_priv->currently_mapped = I830_BUF_MAPPED;
unlock_kernel();
- if (remap_page_range(vma->vm_start,
+ if (remap_page_range(DRM_RPR_ARG(vma) vma->vm_start,
VM_OFFSET(vma),
vma->vm_end - vma->vm_start,
vma->vm_page_prot)) return -EAGAIN;
@@ -306,22 +306,30 @@ static unsigned long i830_alloc_page(drm_device_t *dev)
if(address == 0UL)
return 0;
+#if LINUX_VERSION_CODE < 0x020500
atomic_inc(&virt_to_page(address)->count);
set_bit(PG_locked, &virt_to_page(address)->flags);
-
+#else
+ get_page(virt_to_page(address));
+ SetPageLocked(virt_to_page(address));
+#endif
return address;
}
static void i830_free_page(drm_device_t *dev, unsigned long page)
{
- if(page == 0UL)
- return;
-
- atomic_dec(&virt_to_page(page)->count);
- clear_bit(PG_locked, &virt_to_page(page)->flags);
- wake_up(&virt_to_page(page)->wait);
- free_page(page);
- return;
+ if (page) {
+#if LINUX_VERSION_CODE < 0x020500
+ atomic_dec(&virt_to_page(page)->count);
+ clear_bit(PG_locked, &virt_to_page(page)->flags);
+ wake_up(&virt_to_page(page)->wait);
+#else
+ struct page *p = virt_to_page(page);
+ put_page(p);
+ unlock_page(p);
+#endif
+ free_page(page);
+ }
}
static int i830_dma_cleanup(drm_device_t *dev)