aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/videobuf-dma-sg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/videobuf-dma-sg.c')
-rw-r--r--drivers/media/video/videobuf-dma-sg.c34
1 files changed, 1 insertions, 33 deletions
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c
index 20f227ee2b3e..ddb8f4b46c03 100644
--- a/drivers/media/video/videobuf-dma-sg.c
+++ b/drivers/media/video/videobuf-dma-sg.c
@@ -69,10 +69,9 @@ static struct scatterlist *videobuf_vmalloc_to_sg(unsigned char *virt,
69 struct page *pg; 69 struct page *pg;
70 int i; 70 int i;
71 71
72 sglist = vmalloc(nr_pages * sizeof(*sglist)); 72 sglist = vzalloc(nr_pages * sizeof(*sglist));
73 if (NULL == sglist) 73 if (NULL == sglist)
74 return NULL; 74 return NULL;
75 memset(sglist, 0, nr_pages * sizeof(*sglist));
76 sg_init_table(sglist, nr_pages); 75 sg_init_table(sglist, nr_pages);
77 for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { 76 for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) {
78 pg = vmalloc_to_page(virt); 77 pg = vmalloc_to_page(virt);
@@ -544,14 +543,6 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
544 543
545 retval = -EINVAL; 544 retval = -EINVAL;
546 545
547 /* This function maintains backwards compatibility with V4L1 and will
548 * map more than one buffer if the vma length is equal to the combined
549 * size of multiple buffers than it will map them together. See
550 * VIDIOCGMBUF in the v4l spec
551 *
552 * TODO: Allow drivers to specify if they support this mode
553 */
554
555 BUG_ON(!mem); 546 BUG_ON(!mem);
556 MAGIC_CHECK(mem->magic, MAGIC_SG_MEM); 547 MAGIC_CHECK(mem->magic, MAGIC_SG_MEM);
557 548
@@ -571,29 +562,6 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
571 } 562 }
572 563
573 last = first; 564 last = first;
574#ifdef CONFIG_VIDEO_V4L1_COMPAT
575 if (size != (vma->vm_end - vma->vm_start)) {
576 /* look for last buffer to map */
577 for (last = first + 1; last < VIDEO_MAX_FRAME; last++) {
578 if (NULL == q->bufs[last])
579 continue;
580 if (V4L2_MEMORY_MMAP != q->bufs[last]->memory)
581 continue;
582 if (q->bufs[last]->map) {
583 retval = -EBUSY;
584 goto done;
585 }
586 size += PAGE_ALIGN(q->bufs[last]->bsize);
587 if (size == (vma->vm_end - vma->vm_start))
588 break;
589 }
590 if (VIDEO_MAX_FRAME == last) {
591 dprintk(1, "mmap app bug: size invalid [size=0x%lx]\n",
592 (vma->vm_end - vma->vm_start));
593 goto done;
594 }
595 }
596#endif
597 565
598 /* create mapping + update buffer list */ 566 /* create mapping + update buffer list */
599 retval = -ENOMEM; 567 retval = -ENOMEM;