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

Commit b29145e9 authored by Prasad Kumpatla's avatar Prasad Kumpatla Committed by Gerrit - the friendly Code Review server
Browse files

dsp: codecs: Add spin_lock_irqsave instead of spin_lock



spin_lock is acquired in process context and trying do the
operation in process context,while the interrupt came and
the same lock is trying to take in interrupt context which
leads to deadlock.To avoid this we are using spin_lock_irqsave
instead of spin_lock.

Change-Id: I9c4a3ac65d92b0612d7c4845212647c51a72065b
Signed-off-by: default avatarPrasad Kumpatla <nkumpat@codeaurora.org>
parent e7efdae3
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -936,6 +936,7 @@ ssize_t audio_in_write(struct file *file,

int audio_in_release(struct inode *inode, struct file *file)
{
	unsigned long flags = 0;
	struct q6audio_in  *audio = file->private_data;

	pr_info("%s: session id %d\n", __func__, audio->ac->session);
@@ -943,11 +944,11 @@ int audio_in_release(struct inode *inode, struct file *file)
	audio_in_disable(audio);
	q6asm_audio_client_free(audio->ac);
	mutex_unlock(&audio->lock);
	spin_lock(&enc_dec_lock);
	spin_lock_irqsave(&enc_dec_lock, flags);
	kfree(audio->enc_cfg);
	kfree(audio->codec_cfg);
	kfree(audio);
	file->private_data = NULL;
	spin_unlock(&enc_dec_lock);
	spin_unlock_irqrestore(&enc_dec_lock, flags);
	return 0;
}
+3 −2
Original line number Diff line number Diff line
@@ -588,6 +588,7 @@ int enable_volume_ramp(struct q6audio_aio *audio)

int audio_aio_release(struct inode *inode, struct file *file)
{
	unsigned long flags = 0;
	struct q6audio_aio *audio = file->private_data;

	pr_debug("%s[%pK]\n", __func__, audio);
@@ -631,11 +632,11 @@ int audio_aio_release(struct inode *inode, struct file *file)
#ifdef CONFIG_DEBUG_FS
	debugfs_remove(audio->dentry);
#endif
	spin_lock(&enc_dec_lock);
	spin_lock_irqsave(&enc_dec_lock, flags);
	kfree(audio->codec_cfg);
	kfree(audio);
	file->private_data = NULL;
	spin_unlock(&enc_dec_lock);
	spin_unlock_irqrestore(&enc_dec_lock, flags);
	mutex_unlock(&lock);
	return 0;
}
+3 −2
Original line number Diff line number Diff line
@@ -20,8 +20,9 @@ void q6asm_in_cb(uint32_t opcode, uint32_t token,
{
	struct q6audio_in *audio = (struct q6audio_in *)priv;
	unsigned long flags;
	unsigned long en_de_flags;

	spin_lock(&enc_dec_lock);
	spin_lock_irqsave(&enc_dec_lock, en_de_flags);
	if (audio == NULL) {
		pr_err("%s: failed to get q6audio value\n", __func__);
		goto error;
@@ -65,7 +66,7 @@ void q6asm_in_cb(uint32_t opcode, uint32_t token,
	}
	spin_unlock_irqrestore(&audio->dsp_lock, flags);
error:
	spin_unlock(&enc_dec_lock);
	spin_unlock_irqrestore(&enc_dec_lock, en_de_flags);
}

void  audio_in_get_dsp_frames(void *priv,
+3 −2
Original line number Diff line number Diff line
@@ -43,8 +43,9 @@ void audio_aio_cb(uint32_t opcode, uint32_t token,
{
	struct q6audio_aio *audio = (struct q6audio_aio *)priv;
	union msm_audio_event_payload e_payload;
	unsigned long flags = 0;

	spin_lock(&enc_dec_lock);
	spin_lock_irqsave(&enc_dec_lock, flags);
	if (audio == NULL) {
		pr_err("%s: failed to get q6audio value\n", __func__);
		goto error;
@@ -115,7 +116,7 @@ void audio_aio_cb(uint32_t opcode, uint32_t token,
		break;
	}
error:
	spin_unlock(&enc_dec_lock);
	spin_unlock_irqrestore(&enc_dec_lock, flags);
}

int extract_meta_out_info(struct q6audio_aio *audio,