Commit f4ab5d0b authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

media: media/platform: 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.

Note that sun4i-csi didn't unregister the video device at all. That's
now fixed.

Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 11788d9b
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -1597,7 +1597,6 @@ static int aspeed_video_setup_video(struct aspeed_video *video)
	video_set_drvdata(vdev, video);
	rc = video_register_device(vdev, VFL_TYPE_VIDEO, 0);
	if (rc) {
		vb2_queue_release(vbq);
		v4l2_ctrl_handler_free(&video->ctrl_handler);
		v4l2_device_unregister(v4l2_dev);

@@ -1737,9 +1736,7 @@ static int aspeed_video_remove(struct platform_device *pdev)
	clk_unprepare(video->vclk);
	clk_unprepare(video->eclk);

	video_unregister_device(&video->vdev);

	vb2_queue_release(&video->queue);
	vb2_video_unregister_device(&video->vdev);

	v4l2_ctrl_handler_free(&video->ctrl_handler);

+1 −3
Original line number Diff line number Diff line
@@ -1525,10 +1525,8 @@ int mtk_vcodec_dec_queue_init(void *priv, struct vb2_queue *src_vq,
	dst_vq->dev             = &ctx->dev->plat_dev->dev;

	ret = vb2_queue_init(dst_vq);
	if (ret) {
		vb2_queue_release(src_vq);
	if (ret)
		mtk_v4l2_err("Failed to initialize videobuf2 queue(capture)");
	}

	return ret;
}
+1 −7
Original line number Diff line number Diff line
@@ -1453,13 +1453,7 @@ static int m2m_queue_init(void *priv, struct vb2_queue *src_vq,
	dst_vq->allow_zero_bytesused = 1;
	dst_vq->min_buffers_needed = 0;
	dst_vq->dev = inst->core->dev;
	ret = vb2_queue_init(dst_vq);
	if (ret) {
		vb2_queue_release(src_vq);
		return ret;
	}

	return 0;
	return vb2_queue_init(dst_vq);
}

static int vdec_open(struct file *file)
+1 −7
Original line number Diff line number Diff line
@@ -1129,13 +1129,7 @@ static int m2m_queue_init(void *priv, struct vb2_queue *src_vq,
	dst_vq->allow_zero_bytesused = 1;
	dst_vq->min_buffers_needed = 1;
	dst_vq->dev = inst->core->dev;
	ret = vb2_queue_init(dst_vq);
	if (ret) {
		vb2_queue_release(src_vq);
		return ret;
	}

	return 0;
	return vb2_queue_init(dst_vq);
}

static void venc_inst_init(struct venus_inst *inst)
+1 −0
Original line number Diff line number Diff line
@@ -287,6 +287,7 @@ static int sun4i_csi_remove(struct platform_device *pdev)

	v4l2_async_notifier_unregister(&csi->notifier);
	v4l2_async_notifier_cleanup(&csi->notifier);
	vb2_video_unregister_device(&csi->vdev);
	media_device_unregister(&csi->mdev);
	sun4i_csi_dma_unregister(csi);
	media_device_cleanup(&csi->mdev);
Loading