diff options
author | Benjamin Gaignard <benjamin.gaignard@collabora.com> | 2023-11-09 17:34:41 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2023-11-23 12:16:04 +0100 |
commit | 70ab9ec9166db90ab8980aff4f7083512ecddd1f (patch) | |
tree | cb1a19366c54180b9ee2e0a4d36b5e6bde28de6f /drivers/media/pci/tw68 | |
parent | 58415c7e52a6d6245f0afa679e8ec8b78da1523c (diff) | |
download | linux-70ab9ec9166db90ab8980aff4f7083512ecddd1f.tar.gz linux-70ab9ec9166db90ab8980aff4f7083512ecddd1f.tar.bz2 linux-70ab9ec9166db90ab8980aff4f7083512ecddd1f.zip |
media: pci: tw68: 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.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
CC: Fabrizio Castro <fabrizio.castro.jz@renesas.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>
Diffstat (limited to 'drivers/media/pci/tw68')
-rw-r--r-- | drivers/media/pci/tw68/tw68-video.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/pci/tw68/tw68-video.c b/drivers/media/pci/tw68/tw68-video.c index 773a18702d36..79b627ebc92a 100644 --- a/drivers/media/pci/tw68/tw68-video.c +++ b/drivers/media/pci/tw68/tw68-video.c @@ -360,13 +360,14 @@ static int tw68_queue_setup(struct vb2_queue *q, unsigned int sizes[], struct device *alloc_devs[]) { struct tw68_dev *dev = vb2_get_drv_priv(q); - unsigned tot_bufs = q->num_buffers + *num_buffers; + unsigned int q_num_bufs = vb2_get_num_buffers(q); + unsigned int tot_bufs = q_num_bufs + *num_buffers; unsigned size = (dev->fmt->depth * dev->width * dev->height) >> 3; if (tot_bufs < 2) tot_bufs = 2; tot_bufs = tw68_buffer_count(size, tot_bufs); - *num_buffers = tot_bufs - q->num_buffers; + *num_buffers = tot_bufs - q_num_bufs; /* * We allow create_bufs, but only if the sizeimage is >= as the * current sizeimage. The tw68_buffer_count calculation becomes quite |