@@ -12,7 +12,7 @@
#include "lpass-macro-common.h"
static DEFINE_MUTEX(lpass_codec_mutex);
-static int lpass_codec_version;
+static enum lpass_codec_version lpass_codec_version;
struct lpass_macro *lpass_macro_pds_init(struct device *dev)
{
@@ -69,7 +69,7 @@ void lpass_macro_pds_exit(struct lpass_macro *pds)
}
EXPORT_SYMBOL_GPL(lpass_macro_pds_exit);
-void lpass_macro_set_codec_version(int version)
+void lpass_macro_set_codec_version(enum lpass_codec_version version)
{
mutex_lock(&lpass_codec_mutex);
lpass_codec_version = version;
@@ -77,9 +77,9 @@ void lpass_macro_set_codec_version(int version)
}
EXPORT_SYMBOL_GPL(lpass_macro_set_codec_version);
-int lpass_macro_get_codec_version(void)
+enum lpass_codec_version lpass_macro_get_codec_version(void)
{
- int ver;
+ enum lpass_codec_version ver;
mutex_lock(&lpass_codec_mutex);
ver = lpass_codec_version;
@@ -38,8 +38,8 @@ struct lpass_macro {
struct lpass_macro *lpass_macro_pds_init(struct device *dev);
void lpass_macro_pds_exit(struct lpass_macro *pds);
-void lpass_macro_set_codec_version(int version);
-int lpass_macro_get_codec_version(void);
+void lpass_macro_set_codec_version(enum lpass_codec_version version);
+enum lpass_codec_version lpass_macro_get_codec_version(void);
static inline const char *lpass_macro_get_codec_version_string(int version)
{
@@ -642,7 +642,7 @@ struct rx_macro {
int rx_mclk_users;
int clsh_users;
int rx_mclk_cnt;
- int codec_version;
+ enum lpass_codec_version codec_version;
int rxn_reg_stride;
bool is_ear_mode_on;
bool hph_pwr_mode;
Replace 'int' with proper 'enum lpass_codec_version' in every place which handles the parsed codec version (not raw register values!) to be explicit about contents of the variable. This makes code easier to read and compilers could check missing switch cases. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> --- sound/soc/codecs/lpass-macro-common.c | 8 ++++---- sound/soc/codecs/lpass-macro-common.h | 4 ++-- sound/soc/codecs/lpass-rx-macro.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)