summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSivasri Kumar Vanka <sivasri@codeaurora.org>2020-09-28 21:42:33 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2020-10-09 03:39:32 -0700
commite3efb0f91220088ba67327b4e027354f4d36e295 (patch)
tree5f01c07b916cfdb179d81301d72e5386b2812144
parente7a5d9fc8977732276bac645763cc280ed0785bb (diff)
downloadmsm-extra-e3efb0f91220088ba67327b4e027354f4d36e295.tar.gz
ASoC: msm-routing: Add lock in lsm_app_type_cfg_control callbacks
Add routing_lock mutex to protect global variables in _get() & _put() callback of Listen App Type Config mixer control. Change-Id: Id17ee80fce83bdbc6a7371de2aaf3c92fe587caa Signed-off-by: Sivasri Kumar Vanka <sivasri@codeaurora.org>
-rw-r--r--4.0/asoc/msm-pcm-routing-v2.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/4.0/asoc/msm-pcm-routing-v2.c b/4.0/asoc/msm-pcm-routing-v2.c
index f3b22941..4ae560ea 100644
--- a/4.0/asoc/msm-pcm-routing-v2.c
+++ b/4.0/asoc/msm-pcm-routing-v2.c
@@ -22572,6 +22572,7 @@ static int msm_routing_get_lsm_app_type_cfg_control(
kcontrol->private_value)->shift;
int i = 0, j = 0;
+ mutex_lock(&routing_lock);
ucontrol->value.integer.value[i] = num_app_cfg_types;
for (j = 0; j < num_app_cfg_types; ++j) {
@@ -22585,6 +22586,7 @@ static int msm_routing_get_lsm_app_type_cfg_control(
ucontrol->value.integer.value[++i] =
lsm_app_type_cfg[j].num_out_channels;
}
+ mutex_unlock(&routing_lock);
return 0;
}
@@ -22596,9 +22598,11 @@ static int msm_routing_put_lsm_app_type_cfg_control(
kcontrol->private_value)->shift;
int i = 0, j;
+ mutex_lock(&routing_lock);
if (ucontrol->value.integer.value[0] > MAX_APP_TYPES) {
pr_err("%s: number of app types exceed the max supported\n",
__func__);
+ mutex_unlock(&routing_lock);
return -EINVAL;
}
@@ -22619,6 +22623,7 @@ static int msm_routing_put_lsm_app_type_cfg_control(
ucontrol->value.integer.value[i++];
}
+ mutex_unlock(&routing_lock);
return 0;
}