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

Commit fe9b2105 authored by Senthil Kumar Rajagopal's avatar Senthil Kumar Rajagopal
Browse files

msm: camera: Release spinlock in error case



In error case we exit msm_isp_axi_wait_for_cfg_done api without
releasing the spin lock and then we try to take a mutex.
In case mutex is taken by some other thread.
This will make the current thread to sleep and this leads to
CPU core sleep

Change-Id: Id410c96dd01eb18443080e0fb69c655cfce163d9
Signed-off-by: default avatarSenthil Kumar Rajagopal <skrajago@codeaurora.org>
Signed-off-by: default avatarNagesh Subba Reddy <nageshsreddy@codeaurora.org>
parent bb5760c0
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -389,7 +389,8 @@ int msm_isp_axi_check_stream_state(
			if ((stream_info->state == PAUSING ||
				stream_info->state == PAUSED ||
				stream_info->state == RESUME_PENDING ||
				stream_info->state == RESUMING) &&
				stream_info->state == RESUMING ||
				stream_info->state == UPDATING) &&
				(stream_cfg_cmd->cmd == STOP_STREAM ||
				stream_cfg_cmd->cmd == STOP_IMMEDIATELY)) {
				stream_info->state = ACTIVE;
@@ -1391,9 +1392,18 @@ static int msm_isp_axi_wait_for_cfg_done(struct vfe_device *vfe_dev,
	spin_lock_irqsave(&vfe_dev->shared_data_lock, flags);

	for (i = 0; i < VFE_SRC_MAX; i++) {
		if (src_mask & (1 << i))
		if (src_mask & (1 << i)) {
			if (vfe_dev->axi_data.stream_update[i] > 0) {
				pr_err("%s:Stream Update in progress. cnt %d\n",
					__func__,
					vfe_dev->axi_data.stream_update[i]);
				spin_unlock_irqrestore(
					&vfe_dev->shared_data_lock, flags);
				return -EINVAL;
			}
			vfe_dev->axi_data.stream_update[i] = regUpdateCnt;
		}
	}
	if (src_mask) {
		init_completion(&vfe_dev->stream_config_complete);
		vfe_dev->axi_data.pipeline_update = camif_update;
@@ -1667,6 +1677,7 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev,
		}

		stream_info->state = START_PENDING;
		pr_debug("%s, Stream 0x%x\n", __func__, stream_info->stream_id);
		if (src_state) {
			src_mask |= (1 << SRC_TO_INTF(stream_info->stream_src));
			wait_for_complete = 1;
@@ -1737,6 +1748,8 @@ static int msm_isp_stop_axi_stream(struct vfe_device *vfe_dev,
		wait_for_complete_for_this_stream = 0;

		stream_info->state = STOP_PENDING;
		pr_debug("%s, Stream 0x%x,\n", __func__,
			stream_info->stream_id);
		if (stream_info->stream_src == CAMIF_RAW ||
			stream_info->stream_src == IDEAL_RAW) {
			/* We dont get reg update IRQ for raw snapshot
@@ -2121,7 +2134,8 @@ int msm_isp_update_axi_stream(struct vfe_device *vfe_dev, void *arg)
		case UPDATE_STREAM_REMOVE_BUFQ: {
			msm_isp_remove_buf_queue(vfe_dev, stream_info,
				update_info->user_stream_id);

			pr_debug("%s, Remove bufq for Stream 0x%x\n",
				__func__, stream_info->stream_id);
			if (stream_info->state == ACTIVE) {
				stream_info->state = UPDATING;
				mutex_unlock(&vfe_dev->core_mutex);