From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: Ricardo Ribalda <ribalda@chromium.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Subject: Re: [PATCH v4 11/11] uvc: use vb2 ioctl and fop helpers
Date: Tue, 16 Mar 2021 12:29:37 +0100 [thread overview]
Message-ID: <286aaafa-549a-6728-dc76-8ab2b1e6c581@xs4all.nl> (raw)
In-Reply-To: <20210315173609.1547857-12-ribalda@chromium.org>
Hi Ricardo,
On 15/03/2021 18:36, Ricardo Ribalda wrote:
> From: Hans Verkuil <hverkuil@xs4all.nl>
>
> When uvc was written the vb2 ioctl and file operation helpers didn't exist.
>
> This patch switches uvc over to those helpers, which removes a lot of boilerplate
> code and simplifies VIDIOC_G/S_PRIORITY handling and allows us to drop the
> 'privileges' scheme, since that's now handled inside the vb2 helpers.
>
> This makes it possible for uvc to pass the v4l2-compliance streaming tests.
>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
You can merge this patch into 11/11. I analyzed the uvc get_unmapped_area
implementation and it is 100% identical to the vb2_fop_get_unmapped_area
implementation, so let's use that one instead.
Regards.
Hans
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c
index fba9646c8ba5..437e48b32480 100644
--- a/drivers/media/usb/uvc/uvc_queue.c
+++ b/drivers/media/usb/uvc/uvc_queue.c
@@ -247,18 +247,6 @@ int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type,
return 0;
}
-/* -----------------------------------------------------------------------------
- * V4L2 queue operations
- */
-
-#ifndef CONFIG_MMU
-unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
- unsigned long pgoff)
-{
- return vb2_get_unmapped_area(&queue->queue, 0, 0, pgoff, 0);
-}
-#endif
-
/* -----------------------------------------------------------------------------
*
*/
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 348a46637852..172336d6018c 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -1260,20 +1260,6 @@ static long uvc_v4l2_compat_ioctl32(struct file *file,
}
#endif
-#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 uvc_fh *handle = file->private_data;
- struct uvc_streaming *stream = handle->stream;
-
- uvc_dbg(stream->dev, CALLS, "%s\n", __func__);
-
- return uvc_queue_get_unmapped_area(&stream->queue, pgoff);
-}
-#endif
-
const struct v4l2_ioctl_ops uvc_ioctl_ops = {
.vidioc_querycap = uvc_ioctl_querycap,
.vidioc_enum_fmt_vid_cap = uvc_ioctl_enum_fmt_vid_cap,
@@ -1325,7 +1311,7 @@ const struct v4l2_file_operations uvc_fops = {
.mmap = vb2_fop_mmap,
.poll = vb2_fop_poll,
#ifndef CONFIG_MMU
- .get_unmapped_area = uvc_v4l2_get_unmapped_area,
+ .get_unmapped_area = vb2_fop_get_unmapped_area,
#endif
};
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index 4e6f0a25b940..a83b16ba6e6a 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -787,10 +787,7 @@ struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
struct uvc_buffer *buf);
struct uvc_buffer *uvc_queue_get_current_buffer(struct uvc_video_queue *queue);
void uvc_queue_buffer_release(struct uvc_buffer *buf);
-#ifndef CONFIG_MMU
-unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
- unsigned long pgoff);
-#endif
+
static inline int uvc_queue_streaming(struct uvc_video_queue *queue)
{
return vb2_is_streaming(&queue->queue);
prev parent reply other threads:[~2021-03-16 11:30 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-15 17:35 [PATCH v4 00/11] uvcvideo: Fix v4l2-compliance errors Ricardo Ribalda
2021-03-15 17:35 ` [PATCH v4 01/11] media: v4l2-ioctl: Fix check_ext_ctrls Ricardo Ribalda
2021-03-15 17:36 ` [PATCH v4 02/11] media: uvcvideo: Set capability in s_param Ricardo Ribalda
2021-03-15 17:36 ` [PATCH v4 03/11] media: uvcvideo: Return -EIO for control errors Ricardo Ribalda
2021-03-15 17:36 ` [PATCH v4 04/11] media: uvcvideo: set error_idx to count on EACCESS Ricardo Ribalda
2021-03-16 11:20 ` Hans Verkuil
2021-03-15 17:36 ` [PATCH v4 05/11] media: uvcvideo: refactor __uvc_ctrl_add_mapping Ricardo Ribalda
2021-03-15 17:36 ` [PATCH v4 06/11] media: uvcvideo: Add support for V4L2_CTRL_TYPE_CTRL_CLASS Ricardo Ribalda
2021-03-16 8:37 ` Hans Verkuil
2021-03-16 10:08 ` Laurent Pinchart
2021-03-16 10:12 ` Ricardo Ribalda
2021-03-16 11:04 ` Laurent Pinchart
2021-03-15 17:36 ` [PATCH v4 07/11] media: uvcvideo: Use dev->name for querycap() Ricardo Ribalda
2021-03-15 17:36 ` [PATCH v4 08/11] media: uvcvideo: Set unique vdev name based in type Ricardo Ribalda
2021-03-16 10:10 ` Hans Verkuil
2021-03-15 17:36 ` [PATCH v4 09/11] media: uvcvideo: Increase the size of UVC_METADATA_BUF_SIZE Ricardo Ribalda
2021-03-16 9:45 ` Hans Verkuil
2021-03-15 17:36 ` [PATCH v4 10/11] media: uvcvideo: Return -EACCES to inactive controls Ricardo Ribalda
2021-03-15 17:36 ` [PATCH v4 11/11] uvc: use vb2 ioctl and fop helpers Ricardo Ribalda
2021-03-16 11:29 ` Hans Verkuil [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=286aaafa-549a-6728-dc76-8ab2b1e6c581@xs4all.nl \
--to=hverkuil-cisco@xs4all.nl \
--cc=hverkuil@xs4all.nl \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=ribalda@chromium.org \
--cc=sergey.senozhatsky@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).