Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5cc7f9abec8391e43b0a052c8880509668e24b35
Commit:     5cc7f9abec8391e43b0a052c8880509668e24b35
Parent:     8311d570bcb3faea68941ebd5e240eb2e96d65a0
Author:     Dave Airlie <[EMAIL PROTECTED]>
AuthorDate: Sat Feb 10 11:53:13 2007 +1100
Committer:  Dave Airlie <[EMAIL PROTECTED]>
CommitDate: Sun Mar 11 12:07:17 2007 +1100

    drm: move protection stuff into separate function
    
    Signed-off-by: Dave Airlie <[EMAIL PROTECTED]>
---
 drivers/char/drm/drm_vm.c |   44 ++++++++++++++++++++++++++------------------
 1 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c
index 54a6328..7ed77e1 100644
--- a/drivers/char/drm/drm_vm.c
+++ b/drivers/char/drm/drm_vm.c
@@ -41,6 +41,30 @@
 static void drm_vm_open(struct vm_area_struct *vma);
 static void drm_vm_close(struct vm_area_struct *vma);
 
+pgprot_t drm_io_prot(uint32_t map_type, struct vm_area_struct *vma)
+{
+       pgprot_t tmp = vm_get_page_prot(vma->vm_flags);
+
+#if defined(__i386__) || defined(__x86_64__)
+       if (boot_cpu_data.x86 > 3 && map_type != _DRM_AGP) {
+               pgprot_val(tmp) |= _PAGE_PCD;
+               pgprot_val(tmp) &= ~_PAGE_PWT;
+       }
+#elif defined(__powerpc__)
+       pgprot_val(tmp) |= _PAGE_NO_CACHE;
+       if (map_type == _DRM_REGISTERS)
+               pgprot_val(tmp) |= _PAGE_GUARDED;
+#endif
+#if defined(__ia64__)
+       if (efi_range_is_wc(vma->vm_start, vma->vm_end -
+                                   vma->vm_start))
+               tmp = pgprot_writecombine(tmp);
+       else
+               tmp = pgprot_noncached(tmp);
+#endif
+       return tmp;
+}
+
 /**
  * \c nopage method for AGP virtual memory.
  *
@@ -600,25 +624,9 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
                /* fall through to _DRM_FRAME_BUFFER... */
        case _DRM_FRAME_BUFFER:
        case _DRM_REGISTERS:
-#if defined(__i386__) || defined(__x86_64__)
-               if (boot_cpu_data.x86 > 3 && map->type != _DRM_AGP) {
-                       pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
-                       pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT;
-               }
-#elif defined(__powerpc__)
-               pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
-               if (map->type == _DRM_REGISTERS)
-                       pgprot_val(vma->vm_page_prot) |= _PAGE_GUARDED;
-#endif
-               vma->vm_flags |= VM_IO; /* not in core dump */
-#if defined(__ia64__)
-               if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))
-                       vma->vm_page_prot =
-                           pgprot_writecombine(vma->vm_page_prot);
-               else
-                       vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-#endif
                offset = dev->driver->get_reg_ofs(dev);
+               vma->vm_flags |= VM_IO; /* not in core dump */
+               vma->vm_page_prot = drm_io_prot(map->type, vma);
 #ifdef __sparc__
                vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
                if (io_remap_pfn_range(vma, vma->vm_start,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to