Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
2dc73489 bda24f43

+9 -24
+1 -7
drivers/staging/media/meson/vdec/vdec.c
··· 841 841 dst_vq->min_buffers_needed = 1; 842 842 dst_vq->dev = sess->core->dev; 843 843 dst_vq->lock = &sess->lock; 844 - ret = vb2_queue_init(dst_vq); 845 - if (ret) { 846 - vb2_queue_release(src_vq); 847 - return ret; 848 - } 849 - 850 - return 0; 844 + return vb2_queue_init(dst_vq); 851 845 } 852 846 853 847 static int vdec_init_ctrls(struct amvdec_session *sess)
+1 -1
drivers/staging/media/rkisp1/rkisp1-capture.c
··· 1265 1265 static void rkisp1_unregister_capture(struct rkisp1_capture *cap) 1266 1266 { 1267 1267 media_entity_cleanup(&cap->vnode.vdev.entity); 1268 - video_unregister_device(&cap->vnode.vdev); 1268 + vb2_video_unregister_device(&cap->vnode.vdev); 1269 1269 } 1270 1270 1271 1271 void rkisp1_capture_devs_unregister(struct rkisp1_device *rkisp1)
+2 -5
drivers/staging/media/rkisp1/rkisp1-params.c
··· 1604 1604 node->pad.flags = MEDIA_PAD_FL_SOURCE; 1605 1605 ret = media_entity_pads_init(&vdev->entity, 1, &node->pad); 1606 1606 if (ret) 1607 - goto err_release_queue; 1607 + return ret; 1608 1608 ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1); 1609 1609 if (ret) { 1610 1610 dev_err(rkisp1->dev, ··· 1614 1614 return 0; 1615 1615 err_cleanup_media_entity: 1616 1616 media_entity_cleanup(&vdev->entity); 1617 - err_release_queue: 1618 - vb2_queue_release(vdev->queue); 1619 1617 return ret; 1620 1618 } 1621 1619 ··· 1622 1624 struct rkisp1_vdev_node *node = &params->vnode; 1623 1625 struct video_device *vdev = &node->vdev; 1624 1626 1625 - video_unregister_device(vdev); 1627 + vb2_video_unregister_device(vdev); 1626 1628 media_entity_cleanup(&vdev->entity); 1627 - vb2_queue_release(vdev->queue); 1628 1629 }
+3 -5
drivers/staging/media/rkisp1/rkisp1-stats.c
··· 406 406 node->pad.flags = MEDIA_PAD_FL_SINK; 407 407 ret = media_entity_pads_init(&vdev->entity, 1, &node->pad); 408 408 if (ret) 409 - goto err_release_queue; 409 + goto err_mutex_destroy; 410 410 411 411 ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1); 412 412 if (ret) { ··· 419 419 420 420 err_cleanup_media_entity: 421 421 media_entity_cleanup(&vdev->entity); 422 - err_release_queue: 423 - vb2_queue_release(vdev->queue); 422 + err_mutex_destroy: 424 423 mutex_destroy(&node->vlock); 425 424 return ret; 426 425 } ··· 429 430 struct rkisp1_vdev_node *node = &stats->vnode; 430 431 struct video_device *vdev = &node->vdev; 431 432 432 - video_unregister_device(vdev); 433 + vb2_video_unregister_device(vdev); 433 434 media_entity_cleanup(&vdev->entity); 434 - vb2_queue_release(vdev->queue); 435 435 mutex_destroy(&node->vlock); 436 436 }
+2 -6
drivers/staging/media/tegra-video/vi.c
··· 795 795 struct tegra_csi_channel *csi_chan; 796 796 struct tegra_vi_channel *chan; 797 797 798 - list_for_each_entry(chan, &vi->vi_chans, list) { 799 - video_unregister_device(&chan->video); 800 - mutex_lock(&chan->video_lock); 801 - vb2_queue_release(&chan->queue); 802 - mutex_unlock(&chan->video_lock); 803 - } 798 + list_for_each_entry(chan, &vi->vi_chans, list) 799 + vb2_video_unregister_device(&chan->video); 804 800 805 801 list_for_each_entry(csi_chan, &csi->csi_chans, list) 806 802 v4l2_device_unregister_subdev(&csi_chan->subdev);