OSDN Git Service

media: atomisp: Make it possible to call atomisp_set_fmt() without a file handle
authorHans de Goede <hdegoede@redhat.com>
Sat, 15 Oct 2022 17:21:42 +0000 (18:21 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 25 Nov 2022 08:14:57 +0000 (08:14 +0000)
To fix atomisp_queue_setup() sometimes failing it needs to be able to call
atomisp_set_fmt(), but atomisp_queue_setup() (VIDIOC_REQBUFS) does not get
passed a file handle by the videobuf2 core.

Partly revert commit b3be98f984d4 ("media: atomisp: Remove a couple of not
useful function wrappers") so that atomisp_set_fmt() can be used
without a file handle.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
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 2c06e33..65ad0a3 100644 (file)
@@ -5095,9 +5095,8 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev,
        return css_input_resolution_changed(asd, ffmt);
 }
 
-int atomisp_set_fmt(struct file *file, void *unused, struct v4l2_format *f)
+int atomisp_set_fmt(struct video_device *vdev, struct v4l2_format *f)
 {
-       struct video_device *vdev = video_devdata(file);
        struct atomisp_device *isp = video_get_drvdata(vdev);
        struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev);
        struct atomisp_sub_device *asd = pipe->asd;
index 4c965d1..d9110bb 100644 (file)
@@ -265,7 +265,7 @@ int atomisp_get_sensor_mode_data(struct atomisp_sub_device *asd,
 int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f,
                    bool *res_overflow);
 
-int atomisp_set_fmt(struct file *file, void *fh, struct v4l2_format *f);
+int atomisp_set_fmt(struct video_device *vdev, struct v4l2_format *f);
 
 int atomisp_set_shading_table(struct atomisp_sub_device *asd,
                              struct atomisp_shading_table *shading_table);
index 2e7b52d..90da474 100644 (file)
@@ -665,6 +665,14 @@ static int atomisp_g_input(struct file *file, void *fh, unsigned int *input)
        return 0;
 }
 
+static int atomisp_s_fmt_cap(struct file *file, void *fh,
+                            struct v4l2_format *f)
+{
+       struct video_device *vdev = video_devdata(file);
+
+       return atomisp_set_fmt(vdev, f);
+}
+
 /*
  * set input are used to set current primary/secondary camera
  */
@@ -2399,7 +2407,7 @@ const struct v4l2_ioctl_ops atomisp_ioctl_ops = {
        .vidioc_enum_fmt_vid_cap = atomisp_enum_fmt_cap,
        .vidioc_try_fmt_vid_cap = atomisp_try_fmt_cap,
        .vidioc_g_fmt_vid_cap = atomisp_g_fmt_cap,
-       .vidioc_s_fmt_vid_cap = atomisp_set_fmt,
+       .vidioc_s_fmt_vid_cap = atomisp_s_fmt_cap,
        .vidioc_reqbufs = vb2_ioctl_reqbufs,
        .vidioc_querybuf = vb2_ioctl_querybuf,
        .vidioc_qbuf = atomisp_qbuf_wrapper,