Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fbdev/ps3fb: use vm_iomap_memory()

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>

+6 -12
+6 -12
drivers/video/ps3fb.c
··· 705 705 706 706 static int ps3fb_mmap(struct fb_info *info, struct vm_area_struct *vma) 707 707 { 708 - unsigned long size, offset; 708 + int r; 709 709 710 - size = vma->vm_end - vma->vm_start; 711 - offset = vma->vm_pgoff << PAGE_SHIFT; 712 - if (offset + size > info->fix.smem_len) 713 - return -EINVAL; 714 - 715 - offset += info->fix.smem_start; 716 - if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT, 717 - size, vma->vm_page_prot)) 718 - return -EAGAIN; 710 + r = vm_iomap_memory(vma, info->fix.smem_start, info->fix.smem_len); 719 711 720 712 dev_dbg(info->device, "ps3fb: mmap framebuffer P(%lx)->V(%lx)\n", 721 - offset, vma->vm_start); 722 - return 0; 713 + info->fix.smem_start + vma->vm_pgoff << PAGE_SHIFT, 714 + vma->vm_start); 715 + 716 + return r; 723 717 } 724 718 725 719 /*