提交 4742c82e 编写于 作者: L Laurent Pinchart 提交者: Mauro Carvalho Chehab

[media] uvcvideo: Use videobuf2 .get_unmapped_area() implementation

The get_unmapped_area() operation was forgotten during conversion to
videobuf2. Fix it.
Signed-off-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 616bd4e2
...@@ -207,6 +207,19 @@ int uvc_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma) ...@@ -207,6 +207,19 @@ int uvc_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma)
return ret; return ret;
} }
#ifndef CONFIG_MMU
unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
unsigned long pgoff)
{
unsigned long ret;
mutex_lock(&queue->mutex);
ret = vb2_get_unmapped_area(&queue->queue, 0, 0, pgoff, 0);
mutex_unlock(&queue->mutex);
return ret;
}
#endif
unsigned int uvc_queue_poll(struct uvc_video_queue *queue, struct file *file, unsigned int uvc_queue_poll(struct uvc_video_queue *queue, struct file *file,
poll_table *wait) poll_table *wait)
{ {
...@@ -237,36 +250,6 @@ int uvc_queue_allocated(struct uvc_video_queue *queue) ...@@ -237,36 +250,6 @@ int uvc_queue_allocated(struct uvc_video_queue *queue)
return allocated; return allocated;
} }
#ifndef CONFIG_MMU
/*
* Get unmapped area.
*
* NO-MMU arch need this function to make mmap() work correctly.
*/
unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
unsigned long pgoff)
{
struct uvc_buffer *buffer;
unsigned int i;
unsigned long ret;
mutex_lock(&queue->mutex);
for (i = 0; i < queue->count; ++i) {
buffer = &queue->buffer[i];
if ((buffer->buf.m.offset >> PAGE_SHIFT) == pgoff)
break;
}
if (i == queue->count) {
ret = -EINVAL;
goto done;
}
ret = (unsigned long)buf->mem;
done:
mutex_unlock(&queue->mutex);
return ret;
}
#endif
/* /*
* Enable or disable the video buffers queue. * Enable or disable the video buffers queue.
* *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册