Commit d779fce5 authored by Dimitris Papastamos's avatar Dimitris Papastamos Committed by Mark Brown

ASoC: soc-cache: Ensure flat compression uses a copy of the defaults cache

With the addition of the cache fallback functionality, it is necessary
to ensure that if the register defaults cache was marked as __devinitconst
and the LZO compression is not compiled in the kernel, the fallback to
flat compression will still use a copy of the defaults cache.
Signed-off-by: default avatarDimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 9f040c79
...@@ -1400,8 +1400,8 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec) ...@@ -1400,8 +1400,8 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
ret = snd_soc_cache_read(codec, i, &val); ret = snd_soc_cache_read(codec, i, &val);
if (ret) if (ret)
return ret; return ret;
if (codec_drv->reg_cache_default) if (codec->reg_def_copy)
if (snd_soc_get_cache_val(codec_drv->reg_cache_default, if (snd_soc_get_cache_val(codec->reg_def_copy,
i, codec_drv->reg_word_size) == val) i, codec_drv->reg_word_size) == val)
continue; continue;
ret = snd_soc_write(codec, i, val); ret = snd_soc_write(codec, i, val);
...@@ -1446,16 +1446,8 @@ static int snd_soc_flat_cache_init(struct snd_soc_codec *codec) ...@@ -1446,16 +1446,8 @@ static int snd_soc_flat_cache_init(struct snd_soc_codec *codec)
codec_drv = codec->driver; codec_drv = codec->driver;
reg_size = codec_drv->reg_cache_size * codec_drv->reg_word_size; reg_size = codec_drv->reg_cache_size * codec_drv->reg_word_size;
/* if (codec->reg_def_copy)
* for flat compression, we don't need to keep a copy of the codec->reg_cache = kmemdup(codec->reg_def_copy,
* original defaults register cache as it will definitely not
* be marked as __devinitconst
*/
kfree(codec->reg_def_copy);
codec->reg_def_copy = NULL;
if (codec_drv->reg_cache_default)
codec->reg_cache = kmemdup(codec_drv->reg_cache_default,
reg_size, GFP_KERNEL); reg_size, GFP_KERNEL);
else else
codec->reg_cache = kzalloc(reg_size, GFP_KERNEL); codec->reg_cache = kzalloc(reg_size, GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment