aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-18 00:50:44 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-24 01:41:42 -0400
commitc84deb9d615c02993ce0972a0b34585c7624822f (patch)
tree3663ec0b35a39adc0dda8426deee2bc0e43b212a
parent5171774382959f9a42ecd36bf408f6979effcb6a (diff)
fbdev/sgivwfb: 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>
-rw-r--r--drivers/video/sgivwfb.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c
index 2331fadc272b..b2a8912f6435 100644
--- a/drivers/video/sgivwfb.c
+++ b/drivers/video/sgivwfb.c
@@ -705,23 +705,17 @@ static int sgivwfb_setcolreg(u_int regno, u_int red, u_int green,
705static int sgivwfb_mmap(struct fb_info *info, 705static int sgivwfb_mmap(struct fb_info *info,
706 struct vm_area_struct *vma) 706 struct vm_area_struct *vma)
707{ 707{
708 unsigned long size = vma->vm_end - vma->vm_start; 708 int r;
709 unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
710 709
711 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
712 return -EINVAL;
713 if (offset + size > sgivwfb_mem_size)
714 return -EINVAL;
715 offset += sgivwfb_mem_phys;
716 pgprot_val(vma->vm_page_prot) = 710 pgprot_val(vma->vm_page_prot) =
717 pgprot_val(vma->vm_page_prot) | _PAGE_PCD; 711 pgprot_val(vma->vm_page_prot) | _PAGE_PCD;
718 vma->vm_flags |= VM_IO; 712
719 if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT, 713 r = vm_iomap_memory(vma, sgivwfb_mem_phys, sgivwfb_mem_size);
720 size, vma->vm_page_prot)) 714
721 return -EAGAIN;
722 printk(KERN_DEBUG "sgivwfb: mmap framebuffer P(%lx)->V(%lx)\n", 715 printk(KERN_DEBUG "sgivwfb: mmap framebuffer P(%lx)->V(%lx)\n",
723 offset, vma->vm_start); 716 offset, vma->vm_start);
724 return 0; 717
718 return r;
725} 719}
726 720
727int __init sgivwfb_setup(char *options) 721int __init sgivwfb_setup(char *options)