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: I6857a6e72dcb7f21633919b716910577af4906d2
Signed-off-by: Ajit Pandey <ajitp@codeaurora.org>
This commit is contained in:
Ajit Pandey
2020-02-11 09:57:53 +05:30
committad av Gerrit - the friendly Code Review server
förälder f34687bd3a
incheckning a4804c7337

Visa fil

@@ -22582,6 +22582,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) {
@@ -22595,6 +22596,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;
}
@@ -22606,9 +22608,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;
}
@@ -22628,7 +22632,7 @@ static int msm_routing_put_lsm_app_type_cfg_control(
lsm_app_type_cfg[j].num_out_channels =
ucontrol->value.integer.value[i++];
}
mutex_unlock(&routing_lock);
return 0;
}