]> git.hungrycats.org Git - linux/commitdiff
Make drivers/char/mem.c use remap_pfn_range()
authorLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 21 Oct 2004 08:25:17 +0000 (01:25 -0700)
committerLinus Torvalds <torvalds@evo.osdl.org>
Thu, 21 Oct 2004 08:25:17 +0000 (01:25 -0700)
Rather than the deprecated remap_page_range() function
that can't handle all of the PFN range anyway.

Also, since that will now mark the vma as being special,
there's no need to do it in mmap_mem() any more.

drivers/char/mem.c

index 9d8dbded270e15310f4444b87864d941b344d94a..840a0afaeb1b2735e564c3a212cf45b52f6f0d49 100644 (file)
@@ -192,26 +192,21 @@ static ssize_t write_mem(struct file * file, const char __user * buf,
 
 static int mmap_mem(struct file * file, struct vm_area_struct * vma)
 {
+#ifdef pgprot_noncached
        unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
        int uncached;
 
        uncached = uncached_access(file, offset);
-#ifdef pgprot_noncached
        if (uncached)
                vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 #endif
 
-       /* Don't try to swap out physical pages.. */
-       vma->vm_flags |= VM_RESERVED;
-
-       /*
-        * Don't dump addresses that are not real memory to a core file.
-        */
-       if (uncached)
-               vma->vm_flags |= VM_IO;
-
-       if (remap_page_range(vma, vma->vm_start, offset, vma->vm_end-vma->vm_start,
-                            vma->vm_page_prot))
+       /* Remap-pfn-range will mark the range VM_IO and VM_RESERVED */
+       if (remap_pfn_range(vma,
+                           vma->vm_start,
+                           vma->vm_pgoff,
+                           vma->vm_end-vma->vm_start,
+                           vma->vm_page_prot))
                return -EAGAIN;
        return 0;
 }