Commit 492abcd7 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: qcom/camss: use vb2_video_unregister_device()

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: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Tested-by: default avatarAndrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent f729ef57
......@@ -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
......
......@@ -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;
......
......@@ -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);
}
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment