Skip to content

Commit 23cd08c

Browse files
Hans Verkuilmchehab
authored andcommitted
[media] videobuf2-core: add comments before the WARN_ON
Recently WARN_ON() calls have been added to warn if the driver is not properly returning buffers to vb2 in start_streaming (if it fails) or stop_streaming(). Add comments before those WARN_ON calls that refer to the videobuf2-core.h header that explains what drivers are supposed to do in these situations. That should help point developers in the right direction if they see these warnings. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Pawel Osciak <pawel@osciak.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
1 parent 47bc59c commit 23cd08c

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎drivers/media/v4l2-core/videobuf2-core.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,6 +1762,12 @@ static int vb2_start_streaming(struct vb2_queue *q)
17621762
q->start_streaming_called = 0;
17631763

17641764
dprintk(1, "driver refused to start streaming\n");
1765+
/*
1766+
* If you see this warning, then the driver isn't cleaning up properly
1767+
* after a failed start_streaming(). See the start_streaming()
1768+
* documentation in videobuf2-core.h for more information how buffers
1769+
* should be returned to vb2 in start_streaming().
1770+
*/
17651771
if (WARN_ON(atomic_read(&q->owned_by_drv_count))) {
17661772
unsigned i;
17671773

@@ -2123,6 +2129,12 @@ static void __vb2_queue_cancel(struct vb2_queue *q)
21232129
if (q->start_streaming_called)
21242130
call_void_qop(q, stop_streaming, q);
21252131

2132+
/*
2133+
* If you see this warning, then the driver isn't cleaning up properly
2134+
* in stop_streaming(). See the stop_streaming() documentation in
2135+
* videobuf2-core.h for more information how buffers should be returned
2136+
* to vb2 in stop_streaming().
2137+
*/
21262138
if (WARN_ON(atomic_read(&q->owned_by_drv_count))) {
21272139
for (i = 0; i < q->num_buffers; ++i)
21282140
if (q->bufs[i]->state == VB2_BUF_STATE_ACTIVE)

0 commit comments

Comments
 (0)