fbdev/ps3fb: use vm_iomap_memory()
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Thu, 18 Apr 2013 04:52:42 +0000 (07:52 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 26 Apr 2013 05:28:47 +0000 (08:28 +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: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
drivers/video/ps3fb.c

index 920c27bf3947edeb05540bcce3ac11b8c2bddbf4..d9f08c653d6275ebce317cd8679d92cafdbac5bc 100644 (file)
@@ -705,21 +705,15 @@ static int ps3fb_pan_display(struct fb_var_screeninfo *var,
 
 static int ps3fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
 {
-       unsigned long size, offset;
+       int r;
 
-       size = vma->vm_end - vma->vm_start;
-       offset = vma->vm_pgoff << PAGE_SHIFT;
-       if (offset + size > info->fix.smem_len)
-               return -EINVAL;
-
-       offset += info->fix.smem_start;
-       if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT,
-                           size, vma->vm_page_prot))
-               return -EAGAIN;
+       r = vm_iomap_memory(vma, info->fix.smem_start, info->fix.smem_len);
 
        dev_dbg(info->device, "ps3fb: mmap framebuffer P(%lx)->V(%lx)\n",
-               offset, vma->vm_start);
-       return 0;
+               info->fix.smem_start + vma->vm_pgoff << PAGE_SHIFT,
+               vma->vm_start);
+
+       return r;
 }
 
     /*