Skip to content

Commit 54828c0

Browse files
ribaldahverkuil
authored andcommitted
media: uvcvideo: Split uvc_stop_streaming()
uvc_stop_streaming() is used for meta and video nodes. Split the function in two to avoid confusion. Use this opportunity to rename uvc_start_streaming() to uvc_start_streaming_video(), as it is only called by the video nodes. Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Ricardo Ribalda <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans Verkuil <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent b7ef536 commit 54828c0

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

drivers/media/usb/uvc/uvc_queue.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static void uvc_buffer_finish(struct vb2_buffer *vb)
167167
uvc_video_clock_update(stream, vbuf, buf);
168168
}
169169

170-
static int uvc_start_streaming(struct vb2_queue *vq, unsigned int count)
170+
static int uvc_start_streaming_video(struct vb2_queue *vq, unsigned int count)
171171
{
172172
struct uvc_video_queue *queue = vb2_get_drv_priv(vq);
173173
struct uvc_streaming *stream = uvc_queue_to_stream(queue);
@@ -186,14 +186,22 @@ static int uvc_start_streaming(struct vb2_queue *vq, unsigned int count)
186186
return ret;
187187
}
188188

189-
static void uvc_stop_streaming(struct vb2_queue *vq)
189+
static void uvc_stop_streaming_video(struct vb2_queue *vq)
190190
{
191191
struct uvc_video_queue *queue = vb2_get_drv_priv(vq);
192192

193193
lockdep_assert_irqs_enabled();
194194

195-
if (vq->type != V4L2_BUF_TYPE_META_CAPTURE)
196-
uvc_video_stop_streaming(uvc_queue_to_stream(queue));
195+
uvc_video_stop_streaming(uvc_queue_to_stream(queue));
196+
197+
uvc_queue_return_buffers(queue, UVC_BUF_STATE_ERROR);
198+
}
199+
200+
static void uvc_stop_streaming_meta(struct vb2_queue *vq)
201+
{
202+
struct uvc_video_queue *queue = vb2_get_drv_priv(vq);
203+
204+
lockdep_assert_irqs_enabled();
197205

198206
uvc_queue_return_buffers(queue, UVC_BUF_STATE_ERROR);
199207
}
@@ -203,15 +211,20 @@ static const struct vb2_ops uvc_queue_qops = {
203211
.buf_prepare = uvc_buffer_prepare,
204212
.buf_queue = uvc_buffer_queue,
205213
.buf_finish = uvc_buffer_finish,
206-
.start_streaming = uvc_start_streaming,
207-
.stop_streaming = uvc_stop_streaming,
214+
.start_streaming = uvc_start_streaming_video,
215+
.stop_streaming = uvc_stop_streaming_video,
208216
};
209217

210218
static const struct vb2_ops uvc_meta_queue_qops = {
211219
.queue_setup = uvc_queue_setup,
212220
.buf_prepare = uvc_buffer_prepare,
213221
.buf_queue = uvc_buffer_queue,
214-
.stop_streaming = uvc_stop_streaming,
222+
/*
223+
* .start_streaming is not provided here. Metadata relies on video
224+
* streaming being active. If video isn't streaming, then no metadata
225+
* will arrive either.
226+
*/
227+
.stop_streaming = uvc_stop_streaming_meta,
215228
};
216229

217230
int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type)

0 commit comments

Comments
 (0)