fbdev/fb-puv3: use vm_iomap_memory()
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 17 Apr 2013 10:48:43 +0000 (13:48 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 24 Apr 2013 05:41:41 +0000 (08:41 +0300)
Use vm_iomap_memory() instead of [io_]remap_pfn_range().
vm_iomap_memory() gives us much simpler API to map memory to userspace,
and reduces possibilities for bugs.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
drivers/video/fb-puv3.c

index 7d106f1f49069f78a43feb0dd2bdaee3befa43ca..27fc956166fa5693f03321196b54e3a4744e4bbf 100644 (file)
@@ -640,21 +640,9 @@ static int unifb_pan_display(struct fb_var_screeninfo *var,
 int unifb_mmap(struct fb_info *info,
                    struct vm_area_struct *vma)
 {
-       unsigned long size = vma->vm_end - vma->vm_start;
-       unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
-       unsigned long pos = info->fix.smem_start + offset;
-
-       if (offset + size > info->fix.smem_len)
-               return -EINVAL;
-
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
-       if (io_remap_pfn_range(vma, vma->vm_start, pos >> PAGE_SHIFT, size,
-                               vma->vm_page_prot))
-               return -EAGAIN;
-
-       /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */
-       return 0;
+       return vm_iomap_memory(vma, info->fix.smem_start, info->fix.smem_len);
 }
 
 static struct fb_ops unifb_ops = {