media: atomisp: Use new atomisp_flush_video_pipe() helper in atomisp_streamoff()
authorHans de Goede <hdegoede@redhat.com>
Sat, 8 Oct 2022 15:27:26 +0000 (16:27 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 25 Nov 2022 08:12:26 +0000 (08:12 +0000)
Use the new atomisp_flush_video_pipe() helper instead of open-coding it.

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_ioctl.c

index 329604b..c688f83 100644 (file)
@@ -1732,11 +1732,6 @@ int atomisp_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
        struct pci_dev *pdev = to_pci_dev(isp->dev);
        struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev);
        struct atomisp_sub_device *asd = pipe->asd;
-       struct atomisp_video_pipe *capture_pipe = NULL;
-       struct atomisp_video_pipe *vf_pipe = NULL;
-       struct atomisp_video_pipe *preview_pipe = NULL;
-       struct atomisp_video_pipe *video_pipe = NULL;
-       struct videobuf_buffer *vb, *_vb;
        enum ia_css_pipe_id css_pipe_id;
        int ret;
        unsigned long flags;
@@ -1817,43 +1812,12 @@ int atomisp_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
        css_pipe_id = atomisp_get_css_pipe_id(asd);
        atomisp_css_stop(asd, css_pipe_id, false);
 
-       /* cancel work queue*/
-       if (asd->video_out_capture.users) {
-               capture_pipe = &asd->video_out_capture;
-               wake_up_interruptible(&capture_pipe->capq.wait);
-       }
-       if (asd->video_out_vf.users) {
-               vf_pipe = &asd->video_out_vf;
-               wake_up_interruptible(&vf_pipe->capq.wait);
-       }
-       if (asd->video_out_preview.users) {
-               preview_pipe = &asd->video_out_preview;
-               wake_up_interruptible(&preview_pipe->capq.wait);
-       }
-       if (asd->video_out_video_capture.users) {
-               video_pipe = &asd->video_out_video_capture;
-               wake_up_interruptible(&video_pipe->capq.wait);
-       }
+       atomisp_flush_video_pipe(pipe, true);
+
        ret = videobuf_streamoff(&pipe->capq);
        if (ret)
                return ret;
 
-       /* cleanup css here */
-       /* no need for this, as ISP will be reset anyway */
-       /*atomisp_flush_bufs_in_css(isp);*/
-
-       spin_lock_irqsave(&pipe->irq_lock, flags);
-       list_for_each_entry_safe(vb, _vb, &pipe->activeq, queue) {
-               vb->state = VIDEOBUF_PREPARED;
-               list_del(&vb->queue);
-       }
-       list_for_each_entry_safe(vb, _vb, &pipe->buffers_waiting_for_param, queue) {
-               vb->state = VIDEOBUF_PREPARED;
-               list_del(&vb->queue);
-               pipe->frame_request_config_id[vb->i] = 0;
-       }
-       spin_unlock_irqrestore(&pipe->irq_lock, flags);
-
        atomisp_subdev_cleanup_pending_events(asd);
 stopsensor:
        if (atomisp_subdev_streaming_count(asd) + 1