diff options
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-video.c')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-video.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index abec32c175aa..8ecaa0803e08 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -45,7 +45,7 @@ | |||
45 | #define em28xx_videodbg(fmt, arg...) do {\ | 45 | #define em28xx_videodbg(fmt, arg...) do {\ |
46 | if (video_debug) \ | 46 | if (video_debug) \ |
47 | printk(KERN_INFO "%s %s :"fmt, \ | 47 | printk(KERN_INFO "%s %s :"fmt, \ |
48 | dev->name, __FUNCTION__ , ##arg); } while (0) | 48 | dev->name, __FUNCTION__, ##arg); } while (0) |
49 | 49 | ||
50 | MODULE_AUTHOR(DRIVER_AUTHOR); | 50 | MODULE_AUTHOR(DRIVER_AUTHOR); |
51 | MODULE_DESCRIPTION(DRIVER_DESC); | 51 | MODULE_DESCRIPTION(DRIVER_DESC); |
@@ -189,16 +189,6 @@ static DECLARE_RWSEM(em28xx_disconnect); | |||
189 | 189 | ||
190 | /********************* v4l2 interface ******************************************/ | 190 | /********************* v4l2 interface ******************************************/ |
191 | 191 | ||
192 | static inline unsigned long kvirt_to_pa(unsigned long adr) | ||
193 | { | ||
194 | unsigned long kva, ret; | ||
195 | |||
196 | kva = (unsigned long)page_address(vmalloc_to_page((void *)adr)); | ||
197 | kva |= adr & (PAGE_SIZE - 1); | ||
198 | ret = __pa(kva); | ||
199 | return ret; | ||
200 | } | ||
201 | |||
202 | /* | 192 | /* |
203 | * em28xx_config() | 193 | * em28xx_config() |
204 | * inits registers with sane defaults | 194 | * inits registers with sane defaults |
@@ -616,7 +606,8 @@ static struct vm_operations_struct em28xx_vm_ops = { | |||
616 | static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) | 606 | static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) |
617 | { | 607 | { |
618 | unsigned long size = vma->vm_end - vma->vm_start, | 608 | unsigned long size = vma->vm_end - vma->vm_start, |
619 | start = vma->vm_start, pos, page; | 609 | start = vma->vm_start; |
610 | void *pos; | ||
620 | u32 i; | 611 | u32 i; |
621 | 612 | ||
622 | struct em28xx *dev = filp->private_data; | 613 | struct em28xx *dev = filp->private_data; |
@@ -657,12 +648,10 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) | |||
657 | vma->vm_flags |= VM_IO; | 648 | vma->vm_flags |= VM_IO; |
658 | vma->vm_flags |= VM_RESERVED; /* avoid to swap out this VMA */ | 649 | vma->vm_flags |= VM_RESERVED; /* avoid to swap out this VMA */ |
659 | 650 | ||
660 | pos = (unsigned long)dev->frame[i].bufmem; | 651 | pos = dev->frame[i].bufmem; |
661 | while (size > 0) { /* size is page-aligned */ | 652 | while (size > 0) { /* size is page-aligned */ |
662 | page = vmalloc_to_pfn((void *)pos); | 653 | if (vm_insert_page(vma, start, vmalloc_to_page(pos))) { |
663 | if (remap_pfn_range(vma, start, page, PAGE_SIZE, | 654 | em28xx_videodbg("mmap: vm_insert_page failed\n"); |
664 | vma->vm_page_prot)) { | ||
665 | em28xx_videodbg("mmap: rename page map failed\n"); | ||
666 | up(&dev->fileop_lock); | 655 | up(&dev->fileop_lock); |
667 | return -EAGAIN; | 656 | return -EAGAIN; |
668 | } | 657 | } |