[PATCH 01/16] media: videobuf2: Set start_streaming_called after it's called

Daniel Scally dan.scally at ideasonboard.com
Mon Nov 2 23:40:37 PST 2026


Currently videobuf2 sets start_streaming_called immediately before it
actually calls that operation in the queue's driver. We want to be
able to check in a runtime_resume callback whether a queue is already
streaming or not, but most .start_streaming() operations will call
pm_runtime_resume() themselves to guarantee that the hardware is
active. Setting start_streaming_called before it is actually called
therefore means we can't use vb2_start_streaming_called() to make
that check.

Instead, set start_streaming_called = 1 after actually calling the
operation, and only if it's successful.

Signed-off-by: Daniel Scally <dan.scally at ideasonboard.com>
---
 drivers/media/common/videobuf2/videobuf2-core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
index b0a6084f175733ddd0d8d399538f949266c8966d..cb4b5e818553a8007d000147843778e72d3753e7 100644
--- a/drivers/media/common/videobuf2/videobuf2-core.c
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
@@ -1779,11 +1779,12 @@ static int vb2_start_streaming(struct vb2_queue *q)
 		__enqueue_in_driver(vb);
 
 	/* Tell the driver to start streaming */
-	q->start_streaming_called = 1;
 	ret = call_qop(q, start_streaming, q,
 		       atomic_read(&q->owned_by_drv_count));
-	if (!ret)
+	if (!ret) {
+		q->start_streaming_called = 1;
 		return 0;
+	}
 
 	q->start_streaming_called = 0;
 

-- 
2.43.0




More information about the linux-arm-kernel mailing list