media: atomisp: Stop direct calls to queue num_buffers field
authorBenjamin Gaignard <benjamin.gaignard@collabora.com>
Thu, 9 Nov 2023 16:34:33 +0000 (17:34 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Thu, 23 Nov 2023 11:07:18 +0000 (12:07 +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: Hans de Goede <hdegoede@redhat.com>
CC: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_ioctl.c

index a8a964b2f1a8ee6d47b3d65a74cc3385ef5eb0c4..09c0091b920f58eaf1ce231006c366956f976bc1 100644 (file)
@@ -1028,7 +1028,7 @@ static int atomisp_qbuf_wrapper(struct file *file, void *fh, struct v4l2_buffer
        struct atomisp_device *isp = video_get_drvdata(vdev);
        struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev);
 
-       if (buf->index >= vdev->queue->num_buffers)
+       if (buf->index >= vb2_get_num_buffers(vdev->queue))
                return -EINVAL;
 
        if (buf->reserved2 & ATOMISP_BUFFER_HAS_PER_FRAME_SETTING) {