mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 06:04:23 +08:00
media: touchscreen: sur40: 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> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
8858adab50
commit
1167852857
@ -847,9 +847,10 @@ static int sur40_queue_setup(struct vb2_queue *q,
|
||||
unsigned int sizes[], struct device *alloc_devs[])
|
||||
{
|
||||
struct sur40_state *sur40 = vb2_get_drv_priv(q);
|
||||
unsigned int q_num_bufs = vb2_get_num_buffers(q);
|
||||
|
||||
if (q->num_buffers + *nbuffers < 3)
|
||||
*nbuffers = 3 - q->num_buffers;
|
||||
if (q_num_bufs + *nbuffers < 3)
|
||||
*nbuffers = 3 - q_num_bufs;
|
||||
|
||||
if (*nplanes)
|
||||
return sizes[0] < sur40->pix_fmt.sizeimage ? -EINVAL : 0;
|
||||
|
Loading…
Reference in New Issue
Block a user