Skip to content

Commit 700a488

Browse files
author
Kate Hsuan
committed
media: usb: usbtv: Stop direct calls to queue num_buffers field
JIRA: https://issues.redhat.com/browse/RHEL-86821 commit 4545ca5 Author: Benjamin Gaignard <benjamin.gaignard@collabora.com> Date: Thu Nov 9 17:34:58 2023 +0100 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. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Kate Hsuan <hpa@redhat.com>
1 parent 9e915aa commit 700a488

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/media/usb/usbtv/usbtv-video.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,9 +726,10 @@ static int usbtv_queue_setup(struct vb2_queue *vq,
726726
{
727727
struct usbtv *usbtv = vb2_get_drv_priv(vq);
728728
unsigned size = USBTV_CHUNK * usbtv->n_chunks * 2 * sizeof(u32);
729+
unsigned int q_num_bufs = vb2_get_num_buffers(vq);
729730

730-
if (vq->num_buffers + *nbuffers < 2)
731-
*nbuffers = 2 - vq->num_buffers;
731+
if (q_num_bufs + *nbuffers < 2)
732+
*nbuffers = 2 - q_num_bufs;
732733
if (*nplanes)
733734
return sizes[0] < size ? -EINVAL : 0;
734735
*nplanes = 1;

0 commit comments

Comments
 (0)