media: core: Rework how create_buf index returned value is computed
authorBenjamin Gaignard <benjamin.gaignard@collabora.com>
Thu, 14 Mar 2024 15:32:21 +0000 (16:32 +0100)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 25 Mar 2024 11:00:44 +0000 (12:00 +0100)
commit6e423b75d0492e82fa6f057c615427ebd7ebe76c
tree87c3045393a3565f10c94355897103b1cf04b454
parentf5131d5ce49ef942a3bda5f4a0f6228b1ea40eee
media: core: Rework how create_buf index returned value is computed

When REMOVE_BUFS will be introduced holes could created in bufs array.
To be able to reuse these unused indices reworking how create->index
is set is mandatory.
Let __vb2_queue_alloc() decide which first index is correct and
forward this to the caller.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/common/videobuf2/videobuf2-core.c
drivers/media/common/videobuf2/videobuf2-v4l2.c
include/media/videobuf2-core.h