aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/soc.h1
-rw-r--r--sound/soc/soc-cache.c7
-rw-r--r--sound/soc/soc-core.c7
3 files changed, 5 insertions, 10 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 62f320f56644..577212629d0f 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -662,7 +662,6 @@ struct snd_soc_codec {
662 struct list_head card_list; 662 struct list_head card_list;
663 int num_dai; 663 int num_dai;
664 enum snd_soc_compress_type compress_type; 664 enum snd_soc_compress_type compress_type;
665 size_t reg_size; /* reg_cache_size * reg_word_size */
666 int (*volatile_register)(struct snd_soc_codec *, unsigned int); 665 int (*volatile_register)(struct snd_soc_codec *, unsigned int);
667 int (*readable_register)(struct snd_soc_codec *, unsigned int); 666 int (*readable_register)(struct snd_soc_codec *, unsigned int);
668 int (*writable_register)(struct snd_soc_codec *, unsigned int); 667 int (*writable_register)(struct snd_soc_codec *, unsigned int);
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index a7f83c0c62ce..9542c83d2295 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -122,12 +122,15 @@ static int snd_soc_flat_cache_exit(struct snd_soc_codec *codec)
122static int snd_soc_flat_cache_init(struct snd_soc_codec *codec) 122static int snd_soc_flat_cache_init(struct snd_soc_codec *codec)
123{ 123{
124 const struct snd_soc_codec_driver *codec_drv = codec->driver; 124 const struct snd_soc_codec_driver *codec_drv = codec->driver;
125 size_t reg_size;
126
127 reg_size = codec_drv->reg_cache_size * codec_drv->reg_word_size;
125 128
126 if (codec_drv->reg_cache_default) 129 if (codec_drv->reg_cache_default)
127 codec->reg_cache = kmemdup(codec_drv->reg_cache_default, 130 codec->reg_cache = kmemdup(codec_drv->reg_cache_default,
128 codec->reg_size, GFP_KERNEL); 131 reg_size, GFP_KERNEL);
129 else 132 else
130 codec->reg_cache = kzalloc(codec->reg_size, GFP_KERNEL); 133 codec->reg_cache = kzalloc(reg_size, GFP_KERNEL);
131 if (!codec->reg_cache) 134 if (!codec->reg_cache)
132 return -ENOMEM; 135 return -ENOMEM;
133 136
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index bbe833ab657e..af9648426f4f 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -4159,7 +4159,6 @@ int snd_soc_register_codec(struct device *dev,
4159 struct snd_soc_dai_driver *dai_drv, 4159 struct snd_soc_dai_driver *dai_drv,
4160 int num_dai) 4160 int num_dai)
4161{ 4161{
4162 size_t reg_size;
4163 struct snd_soc_codec *codec; 4162 struct snd_soc_codec *codec;
4164 int ret, i; 4163 int ret, i;
4165 4164
@@ -4197,12 +4196,6 @@ int snd_soc_register_codec(struct device *dev,
4197 codec->num_dai = num_dai; 4196 codec->num_dai = num_dai;
4198 mutex_init(&codec->mutex); 4197 mutex_init(&codec->mutex);
4199 4198
4200 /* allocate CODEC register cache */
4201 if (codec_drv->reg_cache_size && codec_drv->reg_word_size) {
4202 reg_size = codec_drv->reg_cache_size * codec_drv->reg_word_size;
4203 codec->reg_size = reg_size;
4204 }
4205
4206 for (i = 0; i < num_dai; i++) { 4199 for (i = 0; i < num_dai; i++) {
4207 fixup_codec_formats(&dai_drv[i].playback); 4200 fixup_codec_formats(&dai_drv[i].playback);
4208 fixup_codec_formats(&dai_drv[i].capture); 4201 fixup_codec_formats(&dai_drv[i].capture);