drm: cleanup old compat code and DRM fns from Linux only code
[deliverable/linux.git] / drivers / char / drm / drm_vm.c
index 3f73aa774c80975eee97134a29ac43fb0a7de294..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;
        }
 
@@ -188,7 +188,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
 
        map = vma->vm_private_data;
 
-       down(&dev->struct_sem);
+       mutex_lock(&dev->struct_mutex);
        for (pt = dev->vmalist, prev = NULL; pt; pt = next) {
                next = pt->next;
                if (pt->vma->vm_private_data == map)
@@ -248,7 +248,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
                        drm_free(map, sizeof(*map), DRM_MEM_MAPS);
                }
        }
-       up(&dev->struct_sem);
+       mutex_unlock(&dev->struct_mutex);
 }
 
 /**
@@ -404,12 +404,12 @@ static void drm_vm_open(struct vm_area_struct *vma)
 
        vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS);
        if (vma_entry) {
-               down(&dev->struct_sem);
+               mutex_lock(&dev->struct_mutex);
                vma_entry->vma = vma;
                vma_entry->next = dev->vmalist;
                vma_entry->pid = current->pid;
                dev->vmalist = vma_entry;
-               up(&dev->struct_sem);
+               mutex_unlock(&dev->struct_mutex);
        }
 }
 
@@ -431,7 +431,7 @@ static void drm_vm_close(struct vm_area_struct *vma)
                  vma->vm_start, vma->vm_end - vma->vm_start);
        atomic_dec(&dev->vma_count);
 
-       down(&dev->struct_sem);
+       mutex_lock(&dev->struct_mutex);
        for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) {
                if (pt->vma == vma) {
                        if (prev) {
@@ -443,7 +443,7 @@ static void drm_vm_close(struct vm_area_struct *vma)
                        break;
                }
        }
-       up(&dev->struct_sem);
+       mutex_unlock(&dev->struct_mutex);
 }
 
 /**
@@ -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;
        }
 
@@ -619,7 +619,8 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
 #endif
                offset = dev->driver->get_reg_ofs(dev);
 #ifdef __sparc__
-               if (io_remap_pfn_range(DRM_RPR_ARG(vma) vma->vm_start,
+               vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+               if (io_remap_pfn_range(vma, vma->vm_start,
                                       (map->offset + offset) >> PAGE_SHIFT,
                                       vma->vm_end - vma->vm_start,
                                       vma->vm_page_prot))
This page took 0.039294 seconds and 5 git commands to generate.