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

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

Merge "msm: wfd: Lock the state in vsg_start"

parents 108c530b a9749431
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -337,6 +337,7 @@ static int vsg_close(struct v4l2_subdev *sd)
static int vsg_start(struct v4l2_subdev *sd)
{
	struct vsg_context *context = NULL;
	int rc = 0;

	if (!sd) {
		WFD_MSG_ERR("ERROR, invalid arguments into %s\n", __func__);
@@ -345,18 +346,24 @@ static int vsg_start(struct v4l2_subdev *sd)

	context = (struct vsg_context *)sd->dev_priv;

	mutex_lock(&context->mutex);
	if (context->state == VSG_STATE_STARTED) {
		WFD_MSG_ERR("VSG not stopped, start not allowed\n");
		return -EINPROGRESS;
		rc = -EINPROGRESS;
		goto err_bad_state;
	} else if (context->state == VSG_STATE_ERROR) {
		WFD_MSG_ERR("VSG in error state, not allowed to restart\n");
		return -ENOTRECOVERABLE;
		rc = -ENOTRECOVERABLE;
		goto err_bad_state;
	}

	context->state = VSG_STATE_STARTED;
	hrtimer_start(&context->threshold_timer, ns_to_ktime(context->
			max_frame_interval), HRTIMER_MODE_REL);
	return 0;

err_bad_state:
	mutex_unlock(&context->mutex);
	return rc;
}

static int vsg_stop(struct v4l2_subdev *sd)