aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/gadget/uvc_queue.c18
-rw-r--r--drivers/usb/gadget/uvc_v4l2.c15
2 files changed, 33 insertions, 0 deletions
diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c
index 31397954c889..7ce27e35550b 100644
--- a/drivers/usb/gadget/uvc_queue.c
+++ b/drivers/usb/gadget/uvc_queue.c
@@ -232,6 +232,24 @@ static int uvc_queue_mmap(struct uvc_video_queue *queue,
232 return ret; 232 return ret;
233} 233}
234 234
235#ifndef CONFIG_MMU
236/*
237 * Get unmapped area.
238 *
239 * NO-MMU arch need this function to make mmap() work correctly.
240 */
241static unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
242 unsigned long pgoff)
243{
244 unsigned long ret;
245
246 mutex_lock(&queue->mutex);
247 ret = vb2_get_unmapped_area(&queue->queue, 0, 0, pgoff, 0);
248 mutex_unlock(&queue->mutex);
249 return ret;
250}
251#endif
252
235/* 253/*
236 * Cancel the video buffers queue. 254 * Cancel the video buffers queue.
237 * 255 *
diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c
index c058867ea4fb..ad48e81155e2 100644
--- a/drivers/usb/gadget/uvc_v4l2.c
+++ b/drivers/usb/gadget/uvc_v4l2.c
@@ -339,6 +339,18 @@ uvc_v4l2_poll(struct file *file, poll_table *wait)
339 return uvc_queue_poll(&uvc->video.queue, file, wait); 339 return uvc_queue_poll(&uvc->video.queue, file, wait);
340} 340}
341 341
342#ifndef CONFIG_MMU
343static unsigned long uvc_v4l2_get_unmapped_area(struct file *file,
344 unsigned long addr, unsigned long len, unsigned long pgoff,
345 unsigned long flags)
346{
347 struct video_device *vdev = video_devdata(file);
348 struct uvc_device *uvc = video_get_drvdata(vdev);
349
350 return uvc_queue_get_unmapped_area(&uvc->video.queue, pgoff);
351}
352#endif
353
342static struct v4l2_file_operations uvc_v4l2_fops = { 354static struct v4l2_file_operations uvc_v4l2_fops = {
343 .owner = THIS_MODULE, 355 .owner = THIS_MODULE,
344 .open = uvc_v4l2_open, 356 .open = uvc_v4l2_open,
@@ -346,5 +358,8 @@ static struct v4l2_file_operations uvc_v4l2_fops = {
346 .ioctl = uvc_v4l2_ioctl, 358 .ioctl = uvc_v4l2_ioctl,
347 .mmap = uvc_v4l2_mmap, 359 .mmap = uvc_v4l2_mmap,
348 .poll = uvc_v4l2_poll, 360 .poll = uvc_v4l2_poll,
361#ifndef CONFIG_MMU
362 .get_unmapped_area = uvc_v4l2_get_unmapped_area,
363#endif
349}; 364};
350 365