Commit 2dc73489 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: staging/media: drop vb2_queue_release()

This is only needed for drivers that do not use vb2_fop_release().
Note that vb2_queue_release() is *not* the counterpart of vb2_queue_init()
as some drivers here seem to think.

Also use vb2_video_unregister_device() to automatically stop streaming
at unregister time for those drivers that set vdev->queue.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent bda24f43
...@@ -841,13 +841,7 @@ static int m2m_queue_init(void *priv, struct vb2_queue *src_vq, ...@@ -841,13 +841,7 @@ static int m2m_queue_init(void *priv, struct vb2_queue *src_vq,
dst_vq->min_buffers_needed = 1; dst_vq->min_buffers_needed = 1;
dst_vq->dev = sess->core->dev; dst_vq->dev = sess->core->dev;
dst_vq->lock = &sess->lock; dst_vq->lock = &sess->lock;
ret = vb2_queue_init(dst_vq); return vb2_queue_init(dst_vq);
if (ret) {
vb2_queue_release(src_vq);
return ret;
}
return 0;
} }
static int vdec_init_ctrls(struct amvdec_session *sess) static int vdec_init_ctrls(struct amvdec_session *sess)
......
...@@ -1265,7 +1265,7 @@ static const struct v4l2_file_operations rkisp1_fops = { ...@@ -1265,7 +1265,7 @@ static const struct v4l2_file_operations rkisp1_fops = {
static void rkisp1_unregister_capture(struct rkisp1_capture *cap) static void rkisp1_unregister_capture(struct rkisp1_capture *cap)
{ {
media_entity_cleanup(&cap->vnode.vdev.entity); media_entity_cleanup(&cap->vnode.vdev.entity);
video_unregister_device(&cap->vnode.vdev); vb2_video_unregister_device(&cap->vnode.vdev);
} }
void rkisp1_capture_devs_unregister(struct rkisp1_device *rkisp1) void rkisp1_capture_devs_unregister(struct rkisp1_device *rkisp1)
......
...@@ -1604,7 +1604,7 @@ int rkisp1_params_register(struct rkisp1_params *params, ...@@ -1604,7 +1604,7 @@ int rkisp1_params_register(struct rkisp1_params *params,
node->pad.flags = MEDIA_PAD_FL_SOURCE; node->pad.flags = MEDIA_PAD_FL_SOURCE;
ret = media_entity_pads_init(&vdev->entity, 1, &node->pad); ret = media_entity_pads_init(&vdev->entity, 1, &node->pad);
if (ret) if (ret)
goto err_release_queue; return ret;
ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1); ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
if (ret) { if (ret) {
dev_err(rkisp1->dev, dev_err(rkisp1->dev,
...@@ -1614,8 +1614,6 @@ int rkisp1_params_register(struct rkisp1_params *params, ...@@ -1614,8 +1614,6 @@ int rkisp1_params_register(struct rkisp1_params *params,
return 0; return 0;
err_cleanup_media_entity: err_cleanup_media_entity:
media_entity_cleanup(&vdev->entity); media_entity_cleanup(&vdev->entity);
err_release_queue:
vb2_queue_release(vdev->queue);
return ret; return ret;
} }
...@@ -1624,7 +1622,6 @@ void rkisp1_params_unregister(struct rkisp1_params *params) ...@@ -1624,7 +1622,6 @@ void rkisp1_params_unregister(struct rkisp1_params *params)
struct rkisp1_vdev_node *node = &params->vnode; struct rkisp1_vdev_node *node = &params->vnode;
struct video_device *vdev = &node->vdev; struct video_device *vdev = &node->vdev;
video_unregister_device(vdev); vb2_video_unregister_device(vdev);
media_entity_cleanup(&vdev->entity); media_entity_cleanup(&vdev->entity);
vb2_queue_release(vdev->queue);
} }
...@@ -406,7 +406,7 @@ int rkisp1_stats_register(struct rkisp1_stats *stats, ...@@ -406,7 +406,7 @@ int rkisp1_stats_register(struct rkisp1_stats *stats,
node->pad.flags = MEDIA_PAD_FL_SINK; node->pad.flags = MEDIA_PAD_FL_SINK;
ret = media_entity_pads_init(&vdev->entity, 1, &node->pad); ret = media_entity_pads_init(&vdev->entity, 1, &node->pad);
if (ret) if (ret)
goto err_release_queue; goto err_mutex_destroy;
ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1); ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
if (ret) { if (ret) {
...@@ -419,8 +419,7 @@ int rkisp1_stats_register(struct rkisp1_stats *stats, ...@@ -419,8 +419,7 @@ int rkisp1_stats_register(struct rkisp1_stats *stats,
err_cleanup_media_entity: err_cleanup_media_entity:
media_entity_cleanup(&vdev->entity); media_entity_cleanup(&vdev->entity);
err_release_queue: err_mutex_destroy:
vb2_queue_release(vdev->queue);
mutex_destroy(&node->vlock); mutex_destroy(&node->vlock);
return ret; return ret;
} }
...@@ -430,8 +429,7 @@ void rkisp1_stats_unregister(struct rkisp1_stats *stats) ...@@ -430,8 +429,7 @@ void rkisp1_stats_unregister(struct rkisp1_stats *stats)
struct rkisp1_vdev_node *node = &stats->vnode; struct rkisp1_vdev_node *node = &stats->vnode;
struct video_device *vdev = &node->vdev; struct video_device *vdev = &node->vdev;
video_unregister_device(vdev); vb2_video_unregister_device(vdev);
media_entity_cleanup(&vdev->entity); media_entity_cleanup(&vdev->entity);
vb2_queue_release(vdev->queue);
mutex_destroy(&node->vlock); mutex_destroy(&node->vlock);
} }
...@@ -795,12 +795,8 @@ void tegra_v4l2_nodes_cleanup_tpg(struct tegra_video_device *vid) ...@@ -795,12 +795,8 @@ void tegra_v4l2_nodes_cleanup_tpg(struct tegra_video_device *vid)
struct tegra_csi_channel *csi_chan; struct tegra_csi_channel *csi_chan;
struct tegra_vi_channel *chan; struct tegra_vi_channel *chan;
list_for_each_entry(chan, &vi->vi_chans, list) { list_for_each_entry(chan, &vi->vi_chans, list)
video_unregister_device(&chan->video); vb2_video_unregister_device(&chan->video);
mutex_lock(&chan->video_lock);
vb2_queue_release(&chan->queue);
mutex_unlock(&chan->video_lock);
}
list_for_each_entry(csi_chan, &csi->csi_chans, list) list_for_each_entry(csi_chan, &csi->csi_chans, list)
v4l2_device_unregister_subdev(&csi_chan->subdev); v4l2_device_unregister_subdev(&csi_chan->subdev);
......
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