aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-10-29 13:21:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-10-29 13:21:34 -0400
commit7314e613d5ff9f0934f7a0f74ed7973b903315d1 (patch)
tree71c58bf663e85fac4712ab86eaae78e889c41a49 /drivers/video
parentf9ec2e6f7991e748e75e324ed05ca2a7ec360ebb (diff)
Fix a few incorrectly checked [io_]remap_pfn_range() calls
Nico Golde reports a few straggling uses of [io_]remap_pfn_range() that really should use the vm_iomap_memory() helper. This trivially converts two of them to the helper, and comments about why the third one really needs to continue to use remap_pfn_range(), and adds the missing size check. Reported-by: Nico Golde <nico@ngolde.de> Cc: stable@kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org.
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/au1100fb.c26
-rw-r--r--drivers/video/au1200fb.c23
2 files changed, 2 insertions, 47 deletions
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c
index a54ccdc4d661..22ad85242e5b 100644
--- a/drivers/video/au1100fb.c
+++ b/drivers/video/au1100fb.c
@@ -361,37 +361,13 @@ void au1100fb_fb_rotate(struct fb_info *fbi, int angle)
361int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) 361int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma)
362{ 362{
363 struct au1100fb_device *fbdev; 363 struct au1100fb_device *fbdev;
364 unsigned int len;
365 unsigned long start=0, off;
366 364
367 fbdev = to_au1100fb_device(fbi); 365 fbdev = to_au1100fb_device(fbi);
368 366
369 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) {
370 return -EINVAL;
371 }
372
373 start = fbdev->fb_phys & PAGE_MASK;
374 len = PAGE_ALIGN((start & ~PAGE_MASK) + fbdev->fb_len);
375
376 off = vma->vm_pgoff << PAGE_SHIFT;
377
378 if ((vma->vm_end - vma->vm_start + off) > len) {
379 return -EINVAL;
380 }
381
382 off += start;
383 vma->vm_pgoff = off >> PAGE_SHIFT;
384
385 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 367 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
386 pgprot_val(vma->vm_page_prot) |= (6 << 9); //CCA=6 368 pgprot_val(vma->vm_page_prot) |= (6 << 9); //CCA=6
387 369
388 if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, 370 return vm_iomap_memory(vma, fbdev->fb_phys, fbdev->fb_len);
389 vma->vm_end - vma->vm_start,
390 vma->vm_page_prot)) {
391 return -EAGAIN;
392 }
393
394 return 0;
395} 371}
396 372
397static struct fb_ops au1100fb_ops = 373static struct fb_ops au1100fb_ops =
diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c
index 301224ecc950..1d02897d17f2 100644
--- a/drivers/video/au1200fb.c
+++ b/drivers/video/au1200fb.c
@@ -1233,34 +1233,13 @@ static int au1200fb_fb_blank(int blank_mode, struct fb_info *fbi)
1233 * method mainly to allow the use of the TLB streaming flag (CCA=6) 1233 * method mainly to allow the use of the TLB streaming flag (CCA=6)
1234 */ 1234 */
1235static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) 1235static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
1236
1237{ 1236{
1238 unsigned int len;
1239 unsigned long start=0, off;
1240 struct au1200fb_device *fbdev = info->par; 1237 struct au1200fb_device *fbdev = info->par;
1241 1238
1242 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) {
1243 return -EINVAL;
1244 }
1245
1246 start = fbdev->fb_phys & PAGE_MASK;
1247 len = PAGE_ALIGN((start & ~PAGE_MASK) + fbdev->fb_len);
1248
1249 off = vma->vm_pgoff << PAGE_SHIFT;
1250
1251 if ((vma->vm_end - vma->vm_start + off) > len) {
1252 return -EINVAL;
1253 }
1254
1255 off += start;
1256 vma->vm_pgoff = off >> PAGE_SHIFT;
1257
1258 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 1239 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1259 pgprot_val(vma->vm_page_prot) |= _CACHE_MASK; /* CCA=7 */ 1240 pgprot_val(vma->vm_page_prot) |= _CACHE_MASK; /* CCA=7 */
1260 1241
1261 return io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, 1242 return vm_iomap_memory(vma, fbdev->fb_phys, fbdev->fb_len);
1262 vma->vm_end - vma->vm_start,
1263 vma->vm_page_prot);
1264} 1243}
1265 1244
1266static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata) 1245static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata)