Hi Bhupesh,

Thank you for the patch.

On Thursday 17 January 2013 16:23:53 Bhupesh Sharma wrote:
> This patch adds the support for 'get_unmapped_area' in UVC gadget
> which is called when the 'mmap' system call is executed on MMUless
> architectures.
> 
> Signed-off-by: Bhupesh Sharma <bhupesh.sha...@st.com>
> ---
>  drivers/usb/gadget/uvc_queue.c |   18 ++++++++++++++++++
>  drivers/usb/gadget/uvc_queue.h |    5 +++++
>  drivers/usb/gadget/uvc_v4l2.c  |   15 +++++++++++++++
>  3 files changed, 38 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c
> index bd20fab..b8787a0 100644
> --- a/drivers/usb/gadget/uvc_queue.c
> +++ b/drivers/usb/gadget/uvc_queue.c
> @@ -226,6 +226,24 @@ static int uvc_queue_mmap(struct uvc_video_queue
> *queue, return ret;
>  }
> 
> +#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)

This symbol is already defined in the uvcvideo host driver. Queue handling 
code is duplicating, sharing it between the two drivers is somewhere on my to-
do list, but in the meantime a quick workaround is to make this function 
static as uvc_queue.c is #include'd in webcam.c.

> +{
> +     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
> +
>  /*
>   * Cancel the video buffers queue.
>   *
> diff --git a/drivers/usb/gadget/uvc_queue.h b/drivers/usb/gadget/uvc_queue.h
> index 47ad0b8..addfc3d 100644
> --- a/drivers/usb/gadget/uvc_queue.h
> +++ b/drivers/usb/gadget/uvc_queue.h
> @@ -58,6 +58,11 @@ static inline int uvc_queue_streaming(struct
> uvc_video_queue *queue) return vb2_is_streaming(&queue->queue);
>  }
> 
> +#ifndef CONFIG_MMU
> +extern unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue
> *queue, +             unsigned long pgoff);
> +#endif
> +

You could thus remove this change.

>  #endif /* __KERNEL__ */
> 
>  #endif /* _UVC_QUEUE_H_ */
> diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c
> index d03e6c7..ec508d7 100644
> --- a/drivers/usb/gadget/uvc_v4l2.c
> +++ b/drivers/usb/gadget/uvc_v4l2.c
> @@ -348,6 +348,18 @@ uvc_v4l2_poll(struct file *file, poll_table *wait)
>       return mask;
>  }
> 
> +#ifndef CONFIG_MMU
> +static unsigned long uvc_v4l2_get_unmapped_area(struct file *file,
> +             unsigned long addr, unsigned long len, unsigned long pgoff,
> +             unsigned long flags)
> +{
> +     struct video_device *vdev = video_devdata(file);
> +     struct uvc_device *uvc = video_get_drvdata(vdev);
> +
> +     return uvc_queue_get_unmapped_area(&uvc->video.queue, pgoff);
> +}
> +#endif
> +
>  static struct v4l2_file_operations uvc_v4l2_fops = {
>       .owner          = THIS_MODULE,
>       .open           = uvc_v4l2_open,
> @@ -355,5 +367,8 @@ static struct v4l2_file_operations uvc_v4l2_fops = {
>       .ioctl          = uvc_v4l2_ioctl,
>       .mmap           = uvc_v4l2_mmap,
>       .poll           = uvc_v4l2_poll,
> +#ifndef CONFIG_MMU
> +     .get_unmapped_area = uvc_v4l2_get_unmapped_area,
> +#endif
>  };
-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to