OSDN Git Service

media: qcom/camss: use vb2_video_unregister_device()
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 13 Jul 2020 11:30:43 +0000 (13:30 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 28 Aug 2020 12:59:50 +0000 (14:59 +0200)
Use vb2_video_unregister_device() to automatically stop streaming
at unregister time.

This avoids the use of vb2_queue_release() which should not be
called by drivers that set vdev->queue.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Tested-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/qcom/camss/camss-vfe.c
drivers/media/platform/qcom/camss/camss-vfe.h
drivers/media/platform/qcom/camss/camss-video.c
drivers/media/platform/qcom/camss/camss-video.h
drivers/media/platform/qcom/camss/camss.c

index fc31c2c..b7d2293 100644 (file)
@@ -2205,14 +2205,6 @@ static const struct camss_video_ops camss_vfe_video_ops = {
        .flush_buffers = vfe_flush_buffers,
 };
 
-void msm_vfe_stop_streaming(struct vfe_device *vfe)
-{
-       int i;
-
-       for (i = 0; i < ARRAY_SIZE(vfe->line); i++)
-               msm_video_stop_streaming(&vfe->line[i].video_out);
-}
-
 /*
  * msm_vfe_register_entities - Register subdev node for VFE module
  * @vfe: VFE device
index 0d10071..a90b0d2 100644 (file)
@@ -178,8 +178,6 @@ void msm_vfe_unregister_entities(struct vfe_device *vfe);
 void msm_vfe_get_vfe_id(struct media_entity *entity, u8 *id);
 void msm_vfe_get_vfe_line_id(struct media_entity *entity, enum vfe_line_id *id);
 
-void msm_vfe_stop_streaming(struct vfe_device *vfe);
-
 extern const struct vfe_hw_ops vfe_ops_4_1;
 extern const struct vfe_hw_ops vfe_ops_4_7;
 
index cdbd6db..0e2fcee 100644 (file)
@@ -879,7 +879,7 @@ int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev,
        if (ret < 0) {
                dev_err(v4l2_dev->dev, "Failed to init video entity: %d\n",
                        ret);
-               goto error_media_init;
+               goto error_vb2_init;
        }
 
        mutex_init(&video->lock);
@@ -936,23 +936,15 @@ int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev,
 error_video_register:
        media_entity_cleanup(&vdev->entity);
        mutex_destroy(&video->lock);
-error_media_init:
-       vb2_queue_release(&video->vb2_q);
 error_vb2_init:
        mutex_destroy(&video->q_lock);
 
        return ret;
 }
 
-void msm_video_stop_streaming(struct camss_video *video)
-{
-       if (vb2_is_streaming(&video->vb2_q))
-               vb2_queue_release(&video->vb2_q);
-}
-
 void msm_video_unregister(struct camss_video *video)
 {
        atomic_inc(&video->camss->ref_count);
-       video_unregister_device(&video->vdev);
+       vb2_video_unregister_device(&video->vdev);
        atomic_dec(&video->camss->ref_count);
 }
index aa35e8c..bdbae84 100644 (file)
@@ -52,8 +52,6 @@ struct camss_video {
        unsigned int nformats;
 };
 
-void msm_video_stop_streaming(struct camss_video *video);
-
 int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev,
                       const char *name, int is_pix);
 
index 2483641..9186881 100644 (file)
@@ -974,13 +974,8 @@ void camss_delete(struct camss *camss)
  */
 static int camss_remove(struct platform_device *pdev)
 {
-       unsigned int i;
-
        struct camss *camss = platform_get_drvdata(pdev);
 
-       for (i = 0; i < camss->vfe_num; i++)
-               msm_vfe_stop_streaming(&camss->vfe[i]);
-
        v4l2_async_notifier_unregister(&camss->notifier);
        v4l2_async_notifier_cleanup(&camss->notifier);
        camss_unregister_entities(camss);