diff options
author | Benjamin Gaignard <benjamin.gaignard@collabora.com> | 2023-11-09 17:29:20 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2023-11-23 11:57:04 +0100 |
commit | da8fc26b0b7d6c0cf46695ef717458fa248a71fb (patch) | |
tree | e33787efa2b8d173b855e24cb2de35d10410d369 /drivers/media/common/videobuf2/videobuf2-v4l2.c | |
parent | 741d0f6b51032a35446ac72ee8a04fcfa938ee2e (diff) | |
download | linux-stable-da8fc26b0b7d6c0cf46695ef717458fa248a71fb.tar.gz linux-stable-da8fc26b0b7d6c0cf46695ef717458fa248a71fb.tar.bz2 linux-stable-da8fc26b0b7d6c0cf46695ef717458fa248a71fb.zip |
media: videobuf2: Use vb2_get_num_buffers() helper
Stop using queue num_buffers field directly, instead use
vb2_get_num_buffers().
This prepares for the future 'delete buffers' feature where there are
holes in the buffer indices.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/common/videobuf2/videobuf2-v4l2.c')
-rw-r--r-- | drivers/media/common/videobuf2/videobuf2-v4l2.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c index 6ba13a95323c..9d3b828cc804 100644 --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c @@ -621,7 +621,7 @@ struct vb2_buffer *vb2_find_buffer(struct vb2_queue *q, u64 timestamp) * This loop doesn't scale if there is a really large number of buffers. * Maybe something more efficient will be needed in this case. */ - for (i = 0; i < q->num_buffers; i++) { + for (i = 0; i < vb2_get_num_buffers(q); i++) { vb2 = vb2_get_buffer(q, i); if (!vb2) @@ -755,7 +755,7 @@ int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create) fill_buf_caps(q, &create->capabilities); validate_memory_flags(q, create->memory, &create->flags); - create->index = q->num_buffers; + create->index = vb2_get_num_buffers(q); if (create->count == 0) return ret != -EBUSY ? ret : 0; |