diff options
author | Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | 2011-01-12 05:22:28 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-01-12 09:55:12 -0500 |
commit | d779fce5d79525d66269c8f6e430e1515d697f3d (patch) | |
tree | 6e7faaa7a6bb2374dda3cf5c290658334ac9332d /sound/soc/soc-cache.c | |
parent | 9f040c7941df09eca6e6a15cfa766b719d8cafb3 (diff) |
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: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-cache.c')
-rw-r--r-- | sound/soc/soc-cache.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index 9e534429ea63..19b29fb3ca4b 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
@@ -1400,8 +1400,8 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec) | |||
1400 | ret = snd_soc_cache_read(codec, i, &val); | 1400 | ret = snd_soc_cache_read(codec, i, &val); |
1401 | if (ret) | 1401 | if (ret) |
1402 | return ret; | 1402 | return ret; |
1403 | if (codec_drv->reg_cache_default) | 1403 | if (codec->reg_def_copy) |
1404 | if (snd_soc_get_cache_val(codec_drv->reg_cache_default, | 1404 | if (snd_soc_get_cache_val(codec->reg_def_copy, |
1405 | i, codec_drv->reg_word_size) == val) | 1405 | i, codec_drv->reg_word_size) == val) |
1406 | continue; | 1406 | continue; |
1407 | ret = snd_soc_write(codec, i, val); | 1407 | ret = snd_soc_write(codec, i, val); |
@@ -1446,16 +1446,8 @@ static int snd_soc_flat_cache_init(struct snd_soc_codec *codec) | |||
1446 | codec_drv = codec->driver; | 1446 | codec_drv = codec->driver; |
1447 | reg_size = codec_drv->reg_cache_size * codec_drv->reg_word_size; | 1447 | reg_size = codec_drv->reg_cache_size * codec_drv->reg_word_size; |
1448 | 1448 | ||
1449 | /* | 1449 | if (codec->reg_def_copy) |
1450 | * for flat compression, we don't need to keep a copy of the | 1450 | codec->reg_cache = kmemdup(codec->reg_def_copy, |
1451 | * original defaults register cache as it will definitely not | ||
1452 | * be marked as __devinitconst | ||
1453 | */ | ||
1454 | kfree(codec->reg_def_copy); | ||
1455 | codec->reg_def_copy = NULL; | ||
1456 | |||
1457 | if (codec_drv->reg_cache_default) | ||
1458 | codec->reg_cache = kmemdup(codec_drv->reg_cache_default, | ||
1459 | reg_size, GFP_KERNEL); | 1451 | reg_size, GFP_KERNEL); |
1460 | else | 1452 | else |
1461 | codec->reg_cache = kzalloc(reg_size, GFP_KERNEL); | 1453 | codec->reg_cache = kzalloc(reg_size, GFP_KERNEL); |