Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=38315878a560eede1a2db52e511ad3a2cfbb4206
Commit:     38315878a560eede1a2db52e511ad3a2cfbb4206
Parent:     d7d8aac79dc38cbdef83b774e49bafdae9918137
Author:     Hugh Dickins <[EMAIL PROTECTED]>
AuthorDate: Sat Mar 24 17:55:16 2007 +1100
Committer:  Dave Airlie <[EMAIL PROTECTED]>
CommitDate: Sat Mar 24 18:00:28 2007 +1100

    drm: fix DRM_CONSISTENT mapping
    
    This patch got lost in the DRM git tree for ages, bring it back to life.
    
    Signed-off-by: Dave Airlie <[EMAIL PROTECTED]>
---
 drivers/char/drm/drm_vm.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c
index f7d4e29..2d83b0b 100644
--- a/drivers/char/drm/drm_vm.c
+++ b/drivers/char/drm/drm_vm.c
@@ -175,8 +175,7 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct 
vm_area_struct *vma,
 
        offset = address - vma->vm_start;
        i = (unsigned long)map->handle + offset;
-       page = (map->type == _DRM_CONSISTENT) ?
-               virt_to_page((void *)i) : vmalloc_to_page((void *)i);
+       page = vmalloc_to_page((void *)i);
        if (!page)
                return NOPAGE_SIGBUS;
        get_page(page);
@@ -651,10 +650,15 @@ static int drm_mmap_locked(struct file *filp, struct 
vm_area_struct *vma)
                          vma->vm_start, vma->vm_end, map->offset + offset);
                vma->vm_ops = &drm_vm_ops;
                break;
-       case _DRM_SHM:
        case _DRM_CONSISTENT:
-               /* Consistent memory is really like shared memory. It's only
-                * allocate in a different way */
+               /* Consistent memory is really like shared memory. But
+                * it's allocated in a different way, so avoid nopage */
+               if (remap_pfn_range(vma, vma->vm_start,
+                   page_to_pfn(virt_to_page(map->handle)),
+                   vma->vm_end - vma->vm_start, vma->vm_page_prot))
+                       return -EAGAIN;
+       /* fall through to _DRM_SHM */
+       case _DRM_SHM:
                vma->vm_ops = &drm_vm_shm_ops;
                vma->vm_private_data = (void *)map;
                /* Don't let this area swap.  Change when
-
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