diff options
author | Eva Huang <evahuang@google.com> | 2021-06-03 20:18:45 +0800 |
---|---|---|
committer | Eva Huang <evahuang@google.com> | 2021-06-03 20:18:45 +0800 |
commit | 9d4f46987e6c8082b91ec4aff8487be077a31571 (patch) | |
tree | a5b4076d8abb5ba639d66be19c3a7b6aeccd5836 | |
parent | 87efbb8f4dc7025c059c39ac3d1474ebf333d9f0 (diff) | |
parent | 89d086a12ca92640d1be1ae33a2fd2e6e59c8dc8 (diff) | |
download | msm-extra-9d4f46987e6c8082b91ec4aff8487be077a31571.tar.gz |
Merge branch 'android-msm-pixel-4.19-rvc-security' into android-msm-pixel-4.19-rvc-qpr3android-11.0.0_r0.115android-11.0.0_r0.105android-11.0.0_r0.100android-msm-redbull-4.19-android11-qpr3
Aug 2021.1
Bug: 189715888
Change-Id: Ic5e1225a3932b92943fe5fbaea2d363efd776725
-rw-r--r-- | dsp/audio_cal_utils.c | 25 | ||||
-rw-r--r-- | dsp/audio_calibration.c | 3 | ||||
-rw-r--r-- | dsp/q6afe.c | 2 | ||||
-rw-r--r-- | include/dsp/audio_cal_utils.h | 4 |
4 files changed, 28 insertions, 6 deletions
diff --git a/dsp/audio_cal_utils.c b/dsp/audio_cal_utils.c index fab5186a..919a4b1b 100644 --- a/dsp/audio_cal_utils.c +++ b/dsp/audio_cal_utils.c @@ -10,6 +10,8 @@ #include <linux/mutex.h> #include <dsp/audio_cal_utils.h> +struct mutex cal_lock; + static int unmap_memory(struct cal_type_data *cal_type, struct cal_block_data *cal_block); @@ -940,7 +942,9 @@ int cal_utils_dealloc_cal(size_t data_size, void *data, if (ret < 0) goto err; + mutex_lock(&cal_lock); delete_cal_block(cal_block); + mutex_unlock(&cal_lock); err: mutex_unlock(&cal_type->lock); done: @@ -1055,6 +1059,11 @@ void cal_utils_mark_cal_used(struct cal_block_data *cal_block) } EXPORT_SYMBOL(cal_utils_mark_cal_used); +int __init cal_utils_init(void) +{ + mutex_init(&cal_lock); + return 0; +} /** * cal_utils_is_cal_stale * @@ -1064,9 +1073,19 @@ EXPORT_SYMBOL(cal_utils_mark_cal_used); */ bool cal_utils_is_cal_stale(struct cal_block_data *cal_block) { - if ((cal_block) && (cal_block->cal_stale)) - return true; + bool ret = false; - return false; + mutex_lock(&cal_lock); + if (!cal_block) { + pr_err("%s: cal_block is Null", __func__); + goto unlock; + } + + if (cal_block->cal_stale) + ret = true; + +unlock: + mutex_unlock(&cal_lock); + return ret; } EXPORT_SYMBOL(cal_utils_is_cal_stale); diff --git a/dsp/audio_calibration.c b/dsp/audio_calibration.c index a5167be3..854d8821 100644 --- a/dsp/audio_calibration.c +++ b/dsp/audio_calibration.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2014, 2016-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2014, 2016-2017, 2020, The Linux Foundation. All rights reserved. */ #include <linux/slab.h> #include <linux/fs.h> @@ -591,6 +591,7 @@ int __init audio_cal_init(void) pr_debug("%s\n", __func__); + cal_utils_init(); memset(&audio_cal, 0, sizeof(audio_cal)); mutex_init(&audio_cal.common_lock); for (; i < MAX_CAL_TYPES; i++) { diff --git a/dsp/q6afe.c b/dsp/q6afe.c index 2a4ffc8c..c257048b 100644 --- a/dsp/q6afe.c +++ b/dsp/q6afe.c @@ -2739,7 +2739,7 @@ static int send_afe_cal_type(int cal_index, int port_id) this_afe.cal_data[cal_index]); if (cal_block == NULL || cal_utils_is_cal_stale(cal_block)) { - pr_err("%s cal_block not found!!\n", __func__); + pr_err_ratelimited("%s cal_block not found!!\n", __func__); ret = -EINVAL; goto unlock; } diff --git a/include/dsp/audio_cal_utils.h b/include/dsp/audio_cal_utils.h index 06078150..99f619f2 100644 --- a/include/dsp/audio_cal_utils.h +++ b/include/dsp/audio_cal_utils.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2014, 2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2014, 2018, 2020, The Linux Foundation. All rights reserved. */ #ifndef _AUDIO_CAL_UTILS_H #define _AUDIO_CAL_UTILS_H @@ -95,4 +95,6 @@ int32_t cal_utils_get_cal_type_version(void *cal_type_data); void cal_utils_mark_cal_used(struct cal_block_data *cal_block); bool cal_utils_is_cal_stale(struct cal_block_data *cal_block); + +int cal_utils_init(void); #endif |