[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250908091819.GB22977@pendragon.ideasonboard.com>
Date: Mon, 8 Sep 2025 11:18:19 +0200
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Ricardo Ribalda <ribalda@...omium.org>
Cc: Hans de Goede <hansg@...nel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] media: uvcvideo: Move video_device under
video_queue
Hi Ricardo,
On Fri, Jul 25, 2025 at 01:12:49PM +0000, Ricardo Ribalda wrote:
> It is more natural that the "struct video_device" belongs to
> uvc_video_queue instead of uvc_streaming.
>
> This is an aesthetic change. No functional change expected.
>
> Suggested-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>
> Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>
> ---
> drivers/media/usb/uvc/uvc_driver.c | 16 ++++++++--------
> drivers/media/usb/uvc/uvc_metadata.c | 3 +--
> drivers/media/usb/uvc/uvc_v4l2.c | 2 +-
> drivers/media/usb/uvc/uvc_video.c | 2 +-
> drivers/media/usb/uvc/uvcvideo.h | 4 +---
> 5 files changed, 12 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index 3039e6a533b82dd917050d416c9ced8756d69170..505e85a6b4d99666f3a4a9441dd1ca72e13228e0 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -1954,11 +1954,11 @@ static void uvc_unregister_video(struct uvc_device *dev)
>
> list_for_each_entry(stream, &dev->streams, list) {
> /* Nothing to do here, continue. */
> - if (!video_is_registered(&stream->vdev))
> + if (!video_is_registered(&stream->queue.vdev))
> continue;
>
> - vb2_video_unregister_device(&stream->vdev);
> - vb2_video_unregister_device(&stream->meta.vdev);
> + vb2_video_unregister_device(&stream->queue.vdev);
> + vb2_video_unregister_device(&stream->meta.queue.vdev);
>
> /*
> * Now both vdevs are not streaming and all the ioctls will
> @@ -1980,12 +1980,12 @@ static void uvc_unregister_video(struct uvc_device *dev)
>
> int uvc_register_video_device(struct uvc_device *dev,
> struct uvc_streaming *stream,
> - struct video_device *vdev,
> struct uvc_video_queue *queue,
> enum v4l2_buf_type type,
> const struct v4l2_file_operations *fops,
> const struct v4l2_ioctl_ops *ioctl_ops)
> {
> + struct video_device *vdev = &queue->vdev;
> int ret;
>
> /* Initialize the video buffers queue. */
> @@ -2067,9 +2067,9 @@ static int uvc_register_video(struct uvc_device *dev,
> uvc_debugfs_init_stream(stream);
>
> /* Register the device with V4L. */
> - return uvc_register_video_device(dev, stream, &stream->vdev,
> - &stream->queue, stream->type,
> - &uvc_fops, &uvc_ioctl_ops);
> + return uvc_register_video_device(dev, stream, &stream->queue,
> + stream->type, &uvc_fops,
> + &uvc_ioctl_ops);
> }
>
> /*
> @@ -2105,7 +2105,7 @@ static int uvc_register_terms(struct uvc_device *dev,
> */
> uvc_meta_register(stream);
>
> - term->vdev = &stream->vdev;
> + term->vdev = &stream->queue.vdev;
> }
>
> return 0;
> diff --git a/drivers/media/usb/uvc/uvc_metadata.c b/drivers/media/usb/uvc/uvc_metadata.c
> index 649844e2ad60ed9e9951daec871f2000f48702a6..9ed50c3249cbd222be71ffdba18c41ff972158af 100644
> --- a/drivers/media/usb/uvc/uvc_metadata.c
> +++ b/drivers/media/usb/uvc/uvc_metadata.c
> @@ -228,12 +228,11 @@ static int uvc_meta_detect_msxu(struct uvc_device *dev)
> int uvc_meta_register(struct uvc_streaming *stream)
> {
> struct uvc_device *dev = stream->dev;
> - struct video_device *vdev = &stream->meta.vdev;
> struct uvc_video_queue *queue = &stream->meta.queue;
>
> stream->meta.format = V4L2_META_FMT_UVC;
>
> - return uvc_register_video_device(dev, stream, vdev, queue,
> + return uvc_register_video_device(dev, stream, queue,
> V4L2_BUF_TYPE_META_CAPTURE,
> &uvc_meta_fops, &uvc_meta_ioctl_ops);
> }
> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
> index fdc4520a7bb42af7cd5cb9c1fa49957c31e0041c..5b0a7edc9966e7c66438af6daa1f98fa87a6d0d3 100644
> --- a/drivers/media/usb/uvc/uvc_v4l2.c
> +++ b/drivers/media/usb/uvc/uvc_v4l2.c
> @@ -576,7 +576,7 @@ static int uvc_v4l2_open(struct file *file)
> if (!handle)
> return -ENOMEM;
>
> - v4l2_fh_init(&handle->vfh, &stream->vdev);
> + v4l2_fh_init(&handle->vfh, &stream->queue.vdev);
> v4l2_fh_add(&handle->vfh);
> handle->chain = stream->chain;
> handle->stream = stream;
> diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> index 2e377e7b9e81599aca19b800a171cc16a09c1e8a..ef12a935829277d7f1c1ebffcd901742513fbe7e 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -1705,7 +1705,7 @@ static void uvc_video_complete(struct urb *urb)
> struct uvc_streaming *stream = uvc_urb->stream;
> struct uvc_video_queue *queue = &stream->queue;
> struct uvc_video_queue *qmeta = &stream->meta.queue;
> - struct vb2_queue *vb2_qmeta = stream->meta.vdev.queue;
> + struct vb2_queue *vb2_qmeta = stream->meta.queue.vdev.queue;
> struct uvc_buffer *buf = NULL;
> struct uvc_buffer *buf_meta = NULL;
> unsigned long flags;
> diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
> index 86765b9d7935f0888476249c3fb826cd7f36b35c..d4947878fd0126d788d16977a553fa0f45645dcd 100644
> --- a/drivers/media/usb/uvc/uvcvideo.h
> +++ b/drivers/media/usb/uvc/uvcvideo.h
> @@ -328,6 +328,7 @@ struct uvc_buffer {
> #define UVC_QUEUE_DISCONNECTED (1 << 0)
>
> struct uvc_video_queue {
> + struct video_device vdev;
> struct vb2_queue queue;
> struct mutex mutex; /*
> * Serializes vb2_queue and
> @@ -450,7 +451,6 @@ struct uvc_urb {
> struct uvc_streaming {
> struct list_head list;
> struct uvc_device *dev;
> - struct video_device vdev;
> struct uvc_video_chain *chain;
> atomic_t active;
>
> @@ -477,7 +477,6 @@ struct uvc_streaming {
> struct uvc_buffer *meta_buf);
>
> struct {
> - struct video_device vdev;
> struct uvc_video_queue queue;
> u32 format;
> } meta;
> @@ -727,7 +726,6 @@ int uvc_meta_register(struct uvc_streaming *stream);
>
> int uvc_register_video_device(struct uvc_device *dev,
> struct uvc_streaming *stream,
> - struct video_device *vdev,
> struct uvc_video_queue *queue,
> enum v4l2_buf_type type,
> const struct v4l2_file_operations *fops,
--
Regards,
Laurent Pinchart
Powered by blists - more mailing lists