aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/controlfb.c
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-17 06:44:19 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-24 01:41:41 -0400
commit47f698a9f2fc49711f3a43ca6713e83f0e76ea5e (patch)
treed5b47e837632da3a5ec0fe617a278de62c7f4c78 /drivers/video/controlfb.c
parent6d28c21fe7b0921af57b15673cbafd4d61f2653d (diff)
fbdev/controlfb: 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>
Diffstat (limited to 'drivers/video/controlfb.c')
-rw-r--r--drivers/video/controlfb.c50
1 files changed, 20 insertions, 30 deletions
diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c
index 0c189b32a4c5..67b77b40aa7f 100644
--- a/drivers/video/controlfb.c
+++ b/drivers/video/controlfb.c
@@ -285,36 +285,26 @@ static int controlfb_pan_display(struct fb_var_screeninfo *var,
285static int controlfb_mmap(struct fb_info *info, 285static int controlfb_mmap(struct fb_info *info,
286 struct vm_area_struct *vma) 286 struct vm_area_struct *vma)
287{ 287{
288 unsigned long off, start; 288 unsigned long mmio_pgoff;
289 u32 len; 289 unsigned long start;
290 290 u32 len;
291 off = vma->vm_pgoff << PAGE_SHIFT; 291
292 292 start = info->fix.smem_start;
293 /* frame buffer memory */ 293 len = info->fix.smem_len;
294 start = info->fix.smem_start; 294 mmio_pgoff = PAGE_ALIGN((start & ~PAGE_MASK) + len) >> PAGE_SHIFT;
295 len = PAGE_ALIGN((start & ~PAGE_MASK)+info->fix.smem_len); 295 if (vma->vm_pgoff >= mmio_pgoff) {
296 if (off >= len) { 296 if (info->var.accel_flags)
297 /* memory mapped io */ 297 return -EINVAL;
298 off -= len; 298 vma->vm_pgoff -= mmio_pgoff;
299 if (info->var.accel_flags) 299 start = info->fix.mmio_start;
300 return -EINVAL; 300 len = info->fix.mmio_len;
301 start = info->fix.mmio_start; 301 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
302 len = PAGE_ALIGN((start & ~PAGE_MASK)+info->fix.mmio_len); 302 } else {
303 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 303 /* framebuffer */
304 } else { 304 vma->vm_page_prot = pgprot_cached_wthru(vma->vm_page_prot);
305 /* framebuffer */ 305 }
306 vma->vm_page_prot = pgprot_cached_wthru(vma->vm_page_prot); 306
307 } 307 return vm_iomap_memory(vma, start, len);
308 start &= PAGE_MASK;
309 if ((vma->vm_end - vma->vm_start + off) > len)
310 return -EINVAL;
311 off += start;
312 vma->vm_pgoff = off >> PAGE_SHIFT;
313 if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,
314 vma->vm_end - vma->vm_start, vma->vm_page_prot))
315 return -EAGAIN;
316
317 return 0;
318} 308}
319 309
320static int controlfb_blank(int blank_mode, struct fb_info *info) 310static int controlfb_blank(int blank_mode, struct fb_info *info)