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

Commit 6067c8c6 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: Synchronize camera open/close calls."

parents 9a718be2 53f6417b
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -623,6 +623,7 @@ static int camera_v4l2_open(struct file *filep)
	unsigned long opn_idx, idx;
	unsigned long opn_idx, idx;
	BUG_ON(!pvdev);
	BUG_ON(!pvdev);


	mutex_lock(&pvdev->video_drvdata_mutex);
	rc = camera_v4l2_fh_open(filep);
	rc = camera_v4l2_fh_open(filep);
	if (rc < 0) {
	if (rc < 0) {
		pr_err("%s : camera_v4l2_fh_open failed Line %d rc %d\n",
		pr_err("%s : camera_v4l2_fh_open failed Line %d rc %d\n",
@@ -693,6 +694,7 @@ static int camera_v4l2_open(struct file *filep)
	idx |= (1 << find_first_zero_bit((const unsigned long *)&opn_idx,
	idx |= (1 << find_first_zero_bit((const unsigned long *)&opn_idx,
				MSM_CAMERA_STREAM_CNT_BITS));
				MSM_CAMERA_STREAM_CNT_BITS));
	atomic_cmpxchg(&pvdev->opened, opn_idx, idx);
	atomic_cmpxchg(&pvdev->opened, opn_idx, idx);
	mutex_unlock(&pvdev->video_drvdata_mutex);


	return rc;
	return rc;


@@ -707,6 +709,7 @@ stream_fail:
vb2_q_fail:
vb2_q_fail:
	camera_v4l2_fh_release(filep);
	camera_v4l2_fh_release(filep);
fh_open_fail:
fh_open_fail:
	mutex_unlock(&pvdev->video_drvdata_mutex);
	return rc;
	return rc;
}
}


@@ -737,6 +740,7 @@ static int camera_v4l2_close(struct file *filep)
	if (WARN_ON(!session))
	if (WARN_ON(!session))
		return -EIO;
		return -EIO;


	mutex_lock(&pvdev->video_drvdata_mutex);
	mutex_lock(&session->close_lock);
	mutex_lock(&session->close_lock);
	opn_idx = atomic_read(&pvdev->opened);
	opn_idx = atomic_read(&pvdev->opened);
	mask = (1 << sp->stream_id);
	mask = (1 << sp->stream_id);
@@ -778,6 +782,7 @@ static int camera_v4l2_close(struct file *filep)
	}
	}


	camera_v4l2_fh_release(filep);
	camera_v4l2_fh_release(filep);
	mutex_unlock(&pvdev->video_drvdata_mutex);


	return 0;
	return 0;
}
}
@@ -924,6 +929,7 @@ int camera_init_v4l2(struct device *dev, unsigned int *session)


	*session = pvdev->vdev->num;
	*session = pvdev->vdev->num;
	atomic_set(&pvdev->opened, 0);
	atomic_set(&pvdev->opened, 0);
	mutex_init(&pvdev->video_drvdata_mutex);
	video_set_drvdata(pvdev->vdev, pvdev);
	video_set_drvdata(pvdev->vdev, pvdev);
	device_init_wakeup(&pvdev->vdev->dev, 1);
	device_init_wakeup(&pvdev->vdev->dev, 1);
	goto init_end;
	goto init_end;
+1 −0
Original line number Original line Diff line number Diff line
@@ -46,6 +46,7 @@ extern bool is_daemon_status;
struct msm_video_device {
struct msm_video_device {
	struct video_device *vdev;
	struct video_device *vdev;
	atomic_t opened;
	atomic_t opened;
	struct mutex video_drvdata_mutex;
};
};


struct msm_queue_head {
struct msm_queue_head {