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

fbdev/vermillion: 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: Alan Hourihane <alanh@fairlite.demon.co.uk>

+4 -10
+4 -10
drivers/video/vermilion/vermilion.c
··· 1003 1003 static int vmlfb_mmap(struct fb_info *info, struct vm_area_struct *vma) 1004 1004 { 1005 1005 struct vml_info *vinfo = container_of(info, struct vml_info, info); 1006 - unsigned long size = vma->vm_end - vma->vm_start; 1007 1006 unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; 1008 1007 int ret; 1009 1008 1010 - if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) 1011 - return -EINVAL; 1012 - if (offset + size > vinfo->vram_contig_size) 1013 - return -EINVAL; 1014 1009 ret = vmlfb_vram_offset(vinfo, offset); 1015 1010 if (ret) 1016 1011 return -EINVAL; 1017 - offset += vinfo->vram_start; 1012 + 1018 1013 pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; 1019 1014 pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT; 1020 - if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT, 1021 - size, vma->vm_page_prot)) 1022 - return -EAGAIN; 1023 - return 0; 1015 + 1016 + return vm_iomap_memory(vma, vinfo->vram_start, 1017 + vinfo->vram_contig_size); 1024 1018 } 1025 1019 1026 1020 static int vmlfb_sync(struct fb_info *info)