diff options
| -rw-r--r-- | drivers/video/controlfb.c | 50 |
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, | |||
| 285 | static int controlfb_mmap(struct fb_info *info, | 285 | static 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 | ||
| 320 | static int controlfb_blank(int blank_mode, struct fb_info *info) | 310 | static int controlfb_blank(int blank_mode, struct fb_info *info) |
