aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-18 00:47:47 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-24 01:41:42 -0400
commit5171774382959f9a42ecd36bf408f6979effcb6a (patch)
tree0500f1e85a76fcb6de050725861ebde5dd35a287
parent51fc8e8aabf1dc89934743c62069acbbe2016fe9 (diff)
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>
-rw-r--r--drivers/video/vermilion/vermilion.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/video/vermilion/vermilion.c b/drivers/video/vermilion/vermilion.c
index 0aa516fc59cd..09a136633f35 100644
--- a/drivers/video/vermilion/vermilion.c
+++ b/drivers/video/vermilion/vermilion.c
@@ -1003,24 +1003,18 @@ static int vmlfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
1003static int vmlfb_mmap(struct fb_info *info, struct vm_area_struct *vma) 1003static int vmlfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
1004{ 1004{
1005 struct vml_info *vinfo = container_of(info, struct vml_info, info); 1005 struct vml_info *vinfo = container_of(info, struct vml_info, info);
1006 unsigned long size = vma->vm_end - vma->vm_start;
1007 unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; 1006 unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
1008 int ret; 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 ret = vmlfb_vram_offset(vinfo, offset); 1009 ret = vmlfb_vram_offset(vinfo, offset);
1015 if (ret) 1010 if (ret)
1016 return -EINVAL; 1011 return -EINVAL;
1017 offset += vinfo->vram_start; 1012
1018 pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; 1013 pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
1019 pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT; 1014 pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT;
1020 if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT, 1015
1021 size, vma->vm_page_prot)) 1016 return vm_iomap_memory(vma, vinfo->vram_start,
1022 return -EAGAIN; 1017 vinfo->vram_contig_size);
1023 return 0;
1024} 1018}
1025 1019
1026static int vmlfb_sync(struct fb_info *info) 1020static int vmlfb_sync(struct fb_info *info)