Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

[media] soc_camera: always release queue for queue owner



Always release the queue if the owner closes its filehandle and not when
it is the last open filehandle.

Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 2d703835
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line Diff line number Diff line
@@ -788,20 +788,21 @@ static int soc_camera_close(struct file *file)
	struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
	struct soc_camera_host *ici = to_soc_camera_host(icd->parent);


	mutex_lock(&ici->host_lock);
	mutex_lock(&ici->host_lock);
	if (icd->streamer == file) {
		if (ici->ops->init_videobuf2)
			vb2_queue_release(&icd->vb2_vidq);
		icd->streamer = NULL;
	}
	icd->use_count--;
	icd->use_count--;
	if (!icd->use_count) {
	if (!icd->use_count) {
		pm_runtime_suspend(&icd->vdev->dev);
		pm_runtime_suspend(&icd->vdev->dev);
		pm_runtime_disable(&icd->vdev->dev);
		pm_runtime_disable(&icd->vdev->dev);


		if (ici->ops->init_videobuf2)
			vb2_queue_release(&icd->vb2_vidq);
		__soc_camera_power_off(icd);
		__soc_camera_power_off(icd);


		soc_camera_remove_device(icd);
		soc_camera_remove_device(icd);
	}
	}


	if (icd->streamer == file)
		icd->streamer = NULL;
	mutex_unlock(&ici->host_lock);
	mutex_unlock(&ici->host_lock);


	module_put(ici->ops->owner);
	module_put(ici->ops->owner);