aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/drm/drmP.h34
-rw-r--r--drivers/char/drm/drm_bufs.c16
-rw-r--r--drivers/char/drm/drm_vm.c47
-rw-r--r--drivers/char/drm/i810_dma.c5
-rw-r--r--drivers/char/drm/i830_dma.c5
5 files changed, 0 insertions, 107 deletions
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 0a4358996970..6f98701dfe15 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -53,7 +53,6 @@
53#include <linux/init.h> 53#include <linux/init.h>
54#include <linux/file.h> 54#include <linux/file.h>
55#include <linux/pci.h> 55#include <linux/pci.h>
56#include <linux/version.h>
57#include <linux/jiffies.h> 56#include <linux/jiffies.h>
58#include <linux/smp_lock.h> /* For (un)lock_kernel */ 57#include <linux/smp_lock.h> /* For (un)lock_kernel */
59#include <linux/mm.h> 58#include <linux/mm.h>
@@ -161,36 +160,7 @@
161#define pte_unmap(pte) 160#define pte_unmap(pte)
162#endif 161#endif
163 162
164#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
165static inline struct page * vmalloc_to_page(void * vmalloc_addr)
166{
167 unsigned long addr = (unsigned long) vmalloc_addr;
168 struct page *page = NULL;
169 pgd_t *pgd = pgd_offset_k(addr);
170 pmd_t *pmd;
171 pte_t *ptep, pte;
172
173 if (!pgd_none(*pgd)) {
174 pmd = pmd_offset(pgd, addr);
175 if (!pmd_none(*pmd)) {
176 preempt_disable();
177 ptep = pte_offset_map(pmd, addr);
178 pte = *ptep;
179 if (pte_present(pte))
180 page = pte_page(pte);
181 pte_unmap(ptep);
182 preempt_enable();
183 }
184 }
185 return page;
186}
187#endif
188
189#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
190#define DRM_RPR_ARG(vma)
191#else
192#define DRM_RPR_ARG(vma) vma, 163#define DRM_RPR_ARG(vma) vma,
193#endif
194 164
195#define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT) 165#define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT)
196 166
@@ -746,12 +716,8 @@ typedef struct drm_device {
746 int pci_slot; /**< PCI slot number */ 716 int pci_slot; /**< PCI slot number */
747 int pci_func; /**< PCI function number */ 717 int pci_func; /**< PCI function number */
748#ifdef __alpha__ 718#ifdef __alpha__
749#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3)
750 struct pci_controler *hose;
751#else
752 struct pci_controller *hose; 719 struct pci_controller *hose;
753#endif 720#endif
754#endif
755 drm_sg_mem_t *sg; /**< Scatter gather memory */ 721 drm_sg_mem_t *sg; /**< Scatter gather memory */
756 unsigned long *ctx_bitmap; /**< context bitmap */ 722 unsigned long *ctx_bitmap; /**< context bitmap */
757 void *dev_private; /**< device private data */ 723 void *dev_private; /**< device private data */
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
index d1e0b106c261..b70802035d9e 100644
--- a/drivers/char/drm/drm_bufs.c
+++ b/drivers/char/drm/drm_bufs.c
@@ -1499,34 +1499,18 @@ int drm_mapbufs( struct inode *inode, struct file *filp,
1499 goto done; 1499 goto done;
1500 } 1500 }
1501 1501
1502#if LINUX_VERSION_CODE <= 0x020402
1503 down( &current->mm->mmap_sem );
1504#else
1505 down_write( &current->mm->mmap_sem ); 1502 down_write( &current->mm->mmap_sem );
1506#endif
1507 virtual = do_mmap( filp, 0, map->size, 1503 virtual = do_mmap( filp, 0, map->size,
1508 PROT_READ | PROT_WRITE, 1504 PROT_READ | PROT_WRITE,
1509 MAP_SHARED, 1505 MAP_SHARED,
1510 token ); 1506 token );
1511#if LINUX_VERSION_CODE <= 0x020402
1512 up( &current->mm->mmap_sem );
1513#else
1514 up_write( &current->mm->mmap_sem ); 1507 up_write( &current->mm->mmap_sem );
1515#endif
1516 } else { 1508 } else {
1517#if LINUX_VERSION_CODE <= 0x020402
1518 down( &current->mm->mmap_sem );
1519#else
1520 down_write( &current->mm->mmap_sem ); 1509 down_write( &current->mm->mmap_sem );
1521#endif
1522 virtual = do_mmap( filp, 0, dma->byte_count, 1510 virtual = do_mmap( filp, 0, dma->byte_count,
1523 PROT_READ | PROT_WRITE, 1511 PROT_READ | PROT_WRITE,
1524 MAP_SHARED, 0 ); 1512 MAP_SHARED, 0 );
1525#if LINUX_VERSION_CODE <= 0x020402
1526 up( &current->mm->mmap_sem );
1527#else
1528 up_write( &current->mm->mmap_sem ); 1513 up_write( &current->mm->mmap_sem );
1529#endif
1530 } 1514 }
1531 if ( virtual > -1024UL ) { 1515 if ( virtual > -1024UL ) {
1532 /* Real error */ 1516 /* Real error */
diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c
index 99b5c86f7513..292fa7167b26 100644
--- a/drivers/char/drm/drm_vm.c
+++ b/drivers/char/drm/drm_vm.c
@@ -314,8 +314,6 @@ static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma,
314} 314}
315 315
316 316
317#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
318
319static struct page *drm_vm_nopage(struct vm_area_struct *vma, 317static struct page *drm_vm_nopage(struct vm_area_struct *vma,
320 unsigned long address, 318 unsigned long address,
321 int *type) { 319 int *type) {
@@ -344,35 +342,6 @@ static struct page *drm_vm_sg_nopage(struct vm_area_struct *vma,
344 return drm_do_vm_sg_nopage(vma, address); 342 return drm_do_vm_sg_nopage(vma, address);
345} 343}
346 344
347#else /* LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0) */
348
349static struct page *drm_vm_nopage(struct vm_area_struct *vma,
350 unsigned long address,
351 int unused) {
352 return drm_do_vm_nopage(vma, address);
353}
354
355static struct page *drm_vm_shm_nopage(struct vm_area_struct *vma,
356 unsigned long address,
357 int unused) {
358 return drm_do_vm_shm_nopage(vma, address);
359}
360
361static struct page *drm_vm_dma_nopage(struct vm_area_struct *vma,
362 unsigned long address,
363 int unused) {
364 return drm_do_vm_dma_nopage(vma, address);
365}
366
367static struct page *drm_vm_sg_nopage(struct vm_area_struct *vma,
368 unsigned long address,
369 int unused) {
370 return drm_do_vm_sg_nopage(vma, address);
371}
372
373#endif
374
375
376/** AGP virtual memory operations */ 345/** AGP virtual memory operations */
377static struct vm_operations_struct drm_vm_ops = { 346static struct vm_operations_struct drm_vm_ops = {
378 .nopage = drm_vm_nopage, 347 .nopage = drm_vm_nopage,
@@ -496,11 +465,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
496 465
497 vma->vm_ops = &drm_vm_dma_ops; 466 vma->vm_ops = &drm_vm_dma_ops;
498 467
499#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */
500 vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
501#else
502 vma->vm_flags |= VM_RESERVED; /* Don't swap */ 468 vma->vm_flags |= VM_RESERVED; /* Don't swap */
503#endif
504 469
505 vma->vm_file = filp; /* Needed for drm_vm_open() */ 470 vma->vm_file = filp; /* Needed for drm_vm_open() */
506 drm_vm_open(vma); 471 drm_vm_open(vma);
@@ -660,29 +625,17 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
660 vma->vm_private_data = (void *)map; 625 vma->vm_private_data = (void *)map;
661 /* Don't let this area swap. Change when 626 /* Don't let this area swap. Change when
662 DRM_KERNEL advisory is supported. */ 627 DRM_KERNEL advisory is supported. */
663#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */
664 vma->vm_flags |= VM_LOCKED;
665#else
666 vma->vm_flags |= VM_RESERVED; 628 vma->vm_flags |= VM_RESERVED;
667#endif
668 break; 629 break;
669 case _DRM_SCATTER_GATHER: 630 case _DRM_SCATTER_GATHER:
670 vma->vm_ops = &drm_vm_sg_ops; 631 vma->vm_ops = &drm_vm_sg_ops;
671 vma->vm_private_data = (void *)map; 632 vma->vm_private_data = (void *)map;
672#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */
673 vma->vm_flags |= VM_LOCKED;
674#else
675 vma->vm_flags |= VM_RESERVED; 633 vma->vm_flags |= VM_RESERVED;
676#endif
677 break; 634 break;
678 default: 635 default:
679 return -EINVAL; /* This should never happen. */ 636 return -EINVAL; /* This should never happen. */
680 } 637 }
681#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */
682 vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
683#else
684 vma->vm_flags |= VM_RESERVED; /* Don't swap */ 638 vma->vm_flags |= VM_RESERVED; /* Don't swap */
685#endif
686 639
687 vma->vm_file = filp; /* Needed for drm_vm_open() */ 640 vma->vm_file = filp; /* Needed for drm_vm_open() */
688 drm_vm_open(vma); 641 drm_vm_open(vma);
diff --git a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c
index f9fd5abd774b..2f1659b96fd1 100644
--- a/drivers/char/drm/i810_dma.c
+++ b/drivers/char/drm/i810_dma.c
@@ -45,11 +45,6 @@
45#define I810_BUF_UNMAPPED 0 45#define I810_BUF_UNMAPPED 0
46#define I810_BUF_MAPPED 1 46#define I810_BUF_MAPPED 1
47 47
48#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,2)
49#define down_write down
50#define up_write up
51#endif
52
53static drm_buf_t *i810_freelist_get(drm_device_t *dev) 48static drm_buf_t *i810_freelist_get(drm_device_t *dev)
54{ 49{
55 drm_device_dma_t *dma = dev->dma; 50 drm_device_dma_t *dma = dev->dma;
diff --git a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c
index 697cefccd007..6f89d5796ef3 100644
--- a/drivers/char/drm/i830_dma.c
+++ b/drivers/char/drm/i830_dma.c
@@ -47,11 +47,6 @@
47#define I830_BUF_UNMAPPED 0 47#define I830_BUF_UNMAPPED 0
48#define I830_BUF_MAPPED 1 48#define I830_BUF_MAPPED 1
49 49
50#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,2)
51#define down_write down
52#define up_write up
53#endif
54
55static drm_buf_t *i830_freelist_get(drm_device_t *dev) 50static drm_buf_t *i830_freelist_get(drm_device_t *dev)
56{ 51{
57 drm_device_dma_t *dma = dev->dma; 52 drm_device_dma_t *dma = dev->dma;