alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: soc-cache: Ensure flat compression uses a copy of the defaults cache
@ 2011-01-12 10:22 Dimitris Papastamos
  2011-01-12 11:14 ` Liam Girdwood
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dimitris Papastamos @ 2011-01-12 10:22 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood; +Cc: Takashi Iwai, alsa-devel, patches

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>
---
 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 b0d86cc..2f1d596 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)
 		ret = snd_soc_cache_read(codec, i, &val);
 		if (ret)
 			return ret;
-		if (codec_drv->reg_cache_default)
-			if (snd_soc_get_cache_val(codec_drv->reg_cache_default,
+		if (codec->reg_def_copy)
+			if (snd_soc_get_cache_val(codec->reg_def_copy,
 						  i, codec_drv->reg_word_size) == val)
 				continue;
 		ret = snd_soc_write(codec, i, val);
@@ -1446,16 +1446,8 @@ static int snd_soc_flat_cache_init(struct snd_soc_codec *codec)
 	codec_drv = codec->driver;
 	reg_size = codec_drv->reg_cache_size * codec_drv->reg_word_size;
 
-	/*
-	 * for flat compression, we don't need to keep a copy of the
-	 * 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,
+	if (codec->reg_def_copy)
+		codec->reg_cache = kmemdup(codec->reg_def_copy,
 					   reg_size, GFP_KERNEL);
 	else
 		codec->reg_cache = kzalloc(reg_size, GFP_KERNEL);
-- 
1.7.3.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-12 14:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-12 10:22 [PATCH] ASoC: soc-cache: Ensure flat compression uses a copy of the defaults cache Dimitris Papastamos
2011-01-12 11:14 ` Liam Girdwood
2011-01-12 14:56 ` Mark Brown
2011-01-12 14:57 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).