mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
[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 <[email protected]> Signed-off-by: Marek Szyprowski <[email protected]> Signed-off-by: Sylwester Nawrocki <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
This commit is contained in:
parent
bfa8dd3a05
commit
6f524ec156
2 changed files with 38 additions and 0 deletions
|
|
@ -1567,6 +1567,37 @@ int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(vb2_mmap);
|
||||
|
||||
#ifndef CONFIG_MMU
|
||||
unsigned long vb2_get_unmapped_area(struct vb2_queue *q,
|
||||
unsigned long addr,
|
||||
unsigned long len,
|
||||
unsigned long pgoff,
|
||||
unsigned long flags)
|
||||
{
|
||||
unsigned long off = pgoff << PAGE_SHIFT;
|
||||
struct vb2_buffer *vb;
|
||||
unsigned int buffer, plane;
|
||||
int ret;
|
||||
|
||||
if (q->memory != V4L2_MEMORY_MMAP) {
|
||||
dprintk(1, "Queue is not currently set up for mmap\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the plane corresponding to the offset passed by userspace.
|
||||
*/
|
||||
ret = __find_plane_by_offset(q, off, &buffer, &plane);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
vb = q->bufs[buffer];
|
||||
|
||||
return (unsigned long)vb2_plane_vaddr(vb, plane);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(vb2_get_unmapped_area);
|
||||
#endif
|
||||
|
||||
static int __vb2_init_fileio(struct vb2_queue *q, int read);
|
||||
static int __vb2_cleanup_fileio(struct vb2_queue *q);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue