media: atomisp: Remove res_overflow parameter from atomisp_try_fmt()
authorHans de Goede <hdegoede@redhat.com>
Sat, 6 May 2023 18:56:05 +0000 (19:56 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 9 Jun 2023 13:26:04 +0000 (14:26 +0100)
The only remaining caller of atomisp_try_fmt() always passes NULL
for the res_overflow parameter. Drop it and simplify atomisp_try_fmt().

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_cmd.c
drivers/staging/media/atomisp/pci/atomisp_cmd.h
drivers/staging/media/atomisp/pci/atomisp_ioctl.c

index aa790ae..bb49d6f 100644 (file)
@@ -3881,8 +3881,7 @@ static void __atomisp_init_stream_info(u16 stream_index,
 }
 
 /* This function looks up the closest available resolution. */
-int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f,
-                   bool *res_overflow)
+int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f)
 {
        struct atomisp_device *isp = video_get_drvdata(vdev);
        struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd;
@@ -3940,6 +3939,8 @@ int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f,
        }
 
        f->pixelformat = fmt->pixelformat;
+       f->width = format.format.width;
+       f->height = format.format.height;
 
        /*
         * If the format is jpeg or custom RAW, then the width and height will
@@ -3948,22 +3949,8 @@ int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f,
         * the sensor driver.
         */
        if (f->pixelformat == V4L2_PIX_FMT_JPEG ||
-           f->pixelformat == V4L2_PIX_FMT_CUSTOM_M10MO_RAW) {
-               f->width = format.format.width;
-               f->height = format.format.height;
+           f->pixelformat == V4L2_PIX_FMT_CUSTOM_M10MO_RAW)
                return 0;
-       }
-
-       if (!res_overflow || (format.format.width < f->width &&
-                             format.format.height < f->height)) {
-               f->width = format.format.width;
-               f->height = format.format.height;
-               /* Set the flag when resolution requested is
-                * beyond the max value supported by sensor
-                */
-               if (res_overflow)
-                       *res_overflow = true;
-       }
 
        /* app vs isp */
        f->width = rounddown(clamp_t(u32, f->width, ATOM_ISP_MIN_WIDTH,
index 399b549..3cf086e 100644 (file)
@@ -259,8 +259,7 @@ int atomisp_compare_grid(struct atomisp_sub_device *asd,
                         struct atomisp_grid_info *atomgrid);
 
 /* This function looks up the closest available resolution. */
-int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f,
-                   bool *res_overflow);
+int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f);
 
 int atomisp_set_fmt(struct video_device *vdev, struct v4l2_format *f);
 
index 384f31f..4d92779 100644 (file)
@@ -896,7 +896,7 @@ static int atomisp_try_fmt_cap(struct file *file, void *fh,
        f->fmt.pix.width += pad_w;
        f->fmt.pix.height += pad_h;
 
-       ret = atomisp_try_fmt(vdev, &f->fmt.pix, NULL);
+       ret = atomisp_try_fmt(vdev, &f->fmt.pix);
        if (ret)
                return ret;