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

Commit 28cab216 authored by Haynes Mathew George's avatar Haynes Mathew George
Browse files

msm: compr: Use irq{save/restore} version of spinlock



compress driver event handler uses spin_lock/unlock APIs.
It should be sufficient to use the irq{save/restore} versions.

Change-Id: I8f32c6896396a09faa1baf741bd182d8ceb4301a
Signed-off-by: default avatarHaynes Mathew George <hgeorge@codeaurora.org>
parent 28a50082
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -275,11 +275,12 @@ static void compr_event_handler(uint32_t opcode,
	uint32_t sample_rate = 0;
	int bytes_available, stream_id;
	uint32_t stream_index;
	unsigned long flags;

	pr_debug("%s opcode =%08x\n", __func__, opcode);
	switch (opcode) {
	case ASM_DATA_EVENT_WRITE_DONE_V2:
		spin_lock(&prtd->lock);
		spin_lock_irqsave(&prtd->lock, flags);

		if (payload[3]) {
			pr_err("WRITE FAILED w/ err 0x%x !, paddr 0x%x"
@@ -304,7 +305,7 @@ static void compr_event_handler(uint32_t opcode,
			/* Writes must be restarted from _copy() */
			pr_debug("write_done received while not started, treat as xrun");
			atomic_set(&prtd->xrun, 1);
			spin_unlock(&prtd->lock);
			spin_unlock_irqrestore(&prtd->lock, flags);
			break;
		}

@@ -329,10 +330,10 @@ static void compr_event_handler(uint32_t opcode,
		} else
			msm_compr_send_buffer(prtd);

		spin_unlock(&prtd->lock);
		spin_unlock_irqrestore(&prtd->lock, flags);
		break;
	case ASM_DATA_EVENT_RENDERED_EOS:
		spin_lock(&prtd->lock);
		spin_lock_irqsave(&prtd->lock, flags);
		pr_debug("%s: ASM_DATA_CMDRSP_EOS token 0x%x,stream id %d\n",
			  __func__, token, STREAM_ID_FROM_TOKEN(token));
		stream_id = STREAM_ID_FROM_TOKEN(token);
@@ -348,7 +349,7 @@ static void compr_event_handler(uint32_t opcode,
		    stream_index < 0) {
			pr_err("%s: Invalid stream index %d", __func__,
				stream_index);
			spin_unlock(&prtd->lock);
			spin_unlock_irqrestore(&prtd->lock, flags);
			break;
		}

@@ -363,7 +364,7 @@ static void compr_event_handler(uint32_t opcode,
		}
		if (prtd->gapless_state.gapless_transition)
			prtd->gapless_state.gapless_transition = 0;
		spin_unlock(&prtd->lock);
		spin_unlock_irqrestore(&prtd->lock, flags);
		break;
	case ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY:
	case ASM_DATA_EVENT_ENC_SR_CM_CHANGE_NOTIFY: {
@@ -383,7 +384,7 @@ static void compr_event_handler(uint32_t opcode,
			pr_debug("ASM_SESSION_CMD_RUN_V2\n");

			/* FIXME: A state is a better way, dealing with this*/
			spin_lock(&prtd->lock);
			spin_lock_irqsave(&prtd->lock, flags);
			if (!prtd->bytes_sent) {
				bytes_available = prtd->bytes_received - prtd->copied_total;
				if (bytes_available < cstream->runtime->fragment_size) {
@@ -392,7 +393,7 @@ static void compr_event_handler(uint32_t opcode,
				} else
					msm_compr_send_buffer(prtd);
			}
			spin_unlock(&prtd->lock);
			spin_unlock_irqrestore(&prtd->lock, flags);
			break;
		case ASM_STREAM_CMD_FLUSH:
			pr_debug("%s: ASM_STREAM_CMD_FLUSH:", __func__);
@@ -447,11 +448,11 @@ static void compr_event_handler(uint32_t opcode,
	case RESET_EVENTS:
		pr_err("%s: Received reset events CB, move to error state",
			__func__);
		spin_lock(&prtd->lock);
		spin_lock_irqsave(&prtd->lock, flags);
		snd_compr_fragment_elapsed(cstream);
		prtd->copied_total = prtd->bytes_received;
		atomic_set(&prtd->error, 1);
		spin_unlock(&prtd->lock);
		spin_unlock_irqrestore(&prtd->lock, flags);
		break;
	default:
		pr_debug("%s: Not Supported Event opcode[0x%x]\n",