aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-17 06:55:59 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-24 01:41:41 -0400
commit51fc8e8aabf1dc89934743c62069acbbe2016fe9 (patch)
tree45bc9454b259ff5a902cd8b5885464d4c18a316d
parent7b3d1c82417b340c73e416db10770379291010ba (diff)
fbdev/sa1100fb: 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> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--drivers/video/sa1100fb.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
index cfbde5e85cbf..f34c858642e8 100644
--- a/drivers/video/sa1100fb.c
+++ b/drivers/video/sa1100fb.c
@@ -556,7 +556,7 @@ static int sa1100fb_mmap(struct fb_info *info,
556 struct vm_area_struct *vma) 556 struct vm_area_struct *vma)
557{ 557{
558 struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; 558 struct sa1100fb_info *fbi = (struct sa1100fb_info *)info;
559 unsigned long start, len, off = vma->vm_pgoff << PAGE_SHIFT; 559 unsigned long off = vma->vm_pgoff << PAGE_SHIFT;
560 560
561 if (off < info->fix.smem_len) { 561 if (off < info->fix.smem_len) {
562 vma->vm_pgoff += 1; /* skip over the palette */ 562 vma->vm_pgoff += 1; /* skip over the palette */
@@ -564,19 +564,9 @@ static int sa1100fb_mmap(struct fb_info *info,
564 fbi->map_dma, fbi->map_size); 564 fbi->map_dma, fbi->map_size);
565 } 565 }
566 566
567 start = info->fix.mmio_start;
568 len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len);
569
570 if ((vma->vm_end - vma->vm_start + off) > len)
571 return -EINVAL;
572
573 off += start & PAGE_MASK;
574 vma->vm_pgoff = off >> PAGE_SHIFT;
575 vma->vm_flags |= VM_IO;
576 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 567 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
577 return io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, 568
578 vma->vm_end - vma->vm_start, 569 return vm_iomap_memory(vma, info->fix.mmio_start, info->fix.mmio_len);
579 vma->vm_page_prot);
580} 570}
581 571
582static struct fb_ops sa1100fb_ops = { 572static struct fb_ops sa1100fb_ops = {