Skip to content

Commit 78e23c3

Browse files
Benjamin GaignardHans Verkuil
authored andcommitted
media: media videobuf2: Stop direct calls to queue num_buffers field
Use vb2_get_num_buffers() to avoid using queue num_buffers field directly. This allows us to change how the number of buffers is computed in the future. Fixes: d055a76 ("media: core: Report the maximum possible number of buffers for the queue") Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Acked-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
1 parent c14d17a commit 78e23c3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/media/common/videobuf2/videobuf2-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,
989989
bool no_previous_buffers = !q_num_bufs;
990990
int ret = 0;
991991

992-
if (q->num_buffers == q->max_num_buffers) {
992+
if (q_num_bufs == q->max_num_buffers) {
993993
dprintk(q, 1, "maximum number of buffers already allocated\n");
994994
return -ENOBUFS;
995995
}

drivers/media/common/videobuf2/videobuf2-v4l2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ int vb2_ioctl_create_bufs(struct file *file, void *priv,
10291029
int res = vb2_verify_memory_type(vdev->queue, p->memory,
10301030
p->format.type);
10311031

1032-
p->index = vdev->queue->num_buffers;
1032+
p->index = vb2_get_num_buffers(vdev->queue);
10331033
fill_buf_caps(vdev->queue, &p->capabilities);
10341034
validate_memory_flags(vdev->queue, p->memory, &p->flags);
10351035
/*

0 commit comments

Comments
 (0)