aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/videobuf2-core.c
diff options
context:
space:
mode:
authorScott Jiang <[scott.jiang.linux@gmail.com]>2011-09-21 08:25:23 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-03 16:29:13 -0400
commit6f524ec156ba31a18425fad9dd1287be0701d9d1 (patch)
treef9264cae6e442d9d346dc6cc73cb749c62be53a0 /drivers/media/video/videobuf2-core.c
parentbfa8dd3a05248457fce18712e7bc0499030b3100 (diff)
[media] vb2: add vb2_get_unmapped_area in vb2 core
no mmu system needs get_unmapped_area file operations to do mmap Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/videobuf2-core.c')
-rw-r--r--drivers/media/video/videobuf2-core.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c
index 9005dc9991a..979e544388c 100644
--- a/drivers/media/video/videobuf2-core.c
+++ b/drivers/media/video/videobuf2-core.c
@@ -1567,6 +1567,37 @@ int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma)
1567} 1567}
1568EXPORT_SYMBOL_GPL(vb2_mmap); 1568EXPORT_SYMBOL_GPL(vb2_mmap);
1569 1569
1570#ifndef CONFIG_MMU
1571unsigned long vb2_get_unmapped_area(struct vb2_queue *q,
1572 unsigned long addr,
1573 unsigned long len,
1574 unsigned long pgoff,
1575 unsigned long flags)
1576{
1577 unsigned long off = pgoff << PAGE_SHIFT;
1578 struct vb2_buffer *vb;
1579 unsigned int buffer, plane;
1580 int ret;
1581
1582 if (q->memory != V4L2_MEMORY_MMAP) {
1583 dprintk(1, "Queue is not currently set up for mmap\n");
1584 return -EINVAL;
1585 }
1586
1587 /*
1588 * Find the plane corresponding to the offset passed by userspace.
1589 */
1590 ret = __find_plane_by_offset(q, off, &buffer, &plane);
1591 if (ret)
1592 return ret;
1593
1594 vb = q->bufs[buffer];
1595
1596 return (unsigned long)vb2_plane_vaddr(vb, plane);
1597}
1598EXPORT_SYMBOL_GPL(vb2_get_unmapped_area);
1599#endif
1600
1570static int __vb2_init_fileio(struct vb2_queue *q, int read); 1601static int __vb2_init_fileio(struct vb2_queue *q, int read);
1571static int __vb2_cleanup_fileio(struct vb2_queue *q); 1602static int __vb2_cleanup_fileio(struct vb2_queue *q);
1572 1603