Commit 3e412a7b authored by Ricardo Ribalda's avatar Ricardo Ribalda Committed by Hans Verkuil
Browse files

media: uvcvideo: Move video_device under video_queue



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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarHans de Goede <hansg@kernel.org>
Signed-off-by: default avatarHans Verkuil <hverkuil+cisco@kernel.org>
parent 97b6ff86
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -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;
+1 −2
Original line number Diff line number Diff line
@@ -226,12 +226,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);
}
+1 −1
Original line number Diff line number Diff line
@@ -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, file);
	handle->chain = stream->chain;
	handle->stream = stream;
+1 −1
Original line number Diff line number Diff line
@@ -1691,7 +1691,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;
+1 −3
Original line number Diff line number Diff line
@@ -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;
@@ -732,7 +731,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,