mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-10-31 18:09:19 +00:00
soc: msm-pcm: Add missing mutex lock to protect prvt data
Add mutex lock to protect private data in _put() and get() calls. Change-Id: I776ba5739fec4f1ff6542ef48de79ad3873f1161 Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
This commit is contained in:
parent
62d6b9418e
commit
2fe8f6d7b5
1 changed files with 13 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2013-2014, 2017, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013-2014, 2019 The Linux Foundation. All rights reserved.
|
||||
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -30,6 +30,7 @@
|
|||
|
||||
#define LOOPBACK_VOL_MAX_STEPS 0x2000
|
||||
|
||||
static DEFINE_MUTEX(loopback_session_lock);
|
||||
static const DECLARE_TLV_DB_LINEAR(loopback_rx_vol_gain, 0,
|
||||
LOOPBACK_VOL_MAX_STEPS);
|
||||
|
||||
|
@ -226,6 +227,8 @@ static void stop_pcm(struct msm_pcm_loopback *pcm)
|
|||
|
||||
if (pcm->audio_client == NULL)
|
||||
return;
|
||||
|
||||
mutex_lock(&loopback_session_lock);
|
||||
q6asm_cmd(pcm->audio_client, CMD_CLOSE);
|
||||
|
||||
if (pcm->playback_substream != NULL) {
|
||||
|
@ -240,6 +243,7 @@ static void stop_pcm(struct msm_pcm_loopback *pcm)
|
|||
}
|
||||
q6asm_audio_client_free(pcm->audio_client);
|
||||
pcm->audio_client = NULL;
|
||||
mutex_unlock(&loopback_session_lock);
|
||||
}
|
||||
|
||||
static int msm_pcm_close(struct snd_pcm_substream *substream)
|
||||
|
@ -364,12 +368,16 @@ static int msm_pcm_volume_ctl_put(struct snd_kcontrol *kcontrol,
|
|||
rc = -ENODEV;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
mutex_lock(&loopback_session_lock);
|
||||
prtd = substream->runtime->private_data;
|
||||
if (!prtd) {
|
||||
rc = -ENODEV;
|
||||
mutex_unlock(&loopback_session_lock);
|
||||
goto exit;
|
||||
}
|
||||
rc = pcm_loopback_set_volume(prtd, volume);
|
||||
mutex_unlock(&loopback_session_lock);
|
||||
|
||||
exit:
|
||||
return rc;
|
||||
|
@ -390,12 +398,16 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol,
|
|||
rc = -ENODEV;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
mutex_lock(&loopback_session_lock);
|
||||
prtd = substream->runtime->private_data;
|
||||
if (!prtd) {
|
||||
rc = -ENODEV;
|
||||
mutex_unlock(&loopback_session_lock);
|
||||
goto exit;
|
||||
}
|
||||
ucontrol->value.integer.value[0] = prtd->volume;
|
||||
mutex_unlock(&loopback_session_lock);
|
||||
|
||||
exit:
|
||||
return rc;
|
||||
|
|
Loading…
Reference in a new issue