All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: If we can't find a cache compression type default to flat
@ 2010-12-21 17:10 Mark Brown
  2010-12-21 20:28 ` Liam Girdwood
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2010-12-21 17:10 UTC (permalink / raw)
  To: Liam Girdwood, Dimitris Papastamos
  Cc: Takashi Iwai, alsa-devel, patches, Mark Brown

This makes it easier to make cache types build time configurable as we
don't have a hard dependency on a given cache being built in.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/soc-cache.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 678fd75..d78e5b7 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -1531,6 +1531,7 @@ static int snd_soc_flat_cache_init(struct snd_soc_codec *codec)
 
 /* an array of all supported compression types */
 static const struct snd_soc_cache_ops cache_types[] = {
+	/* Flat *must* be the first entry for fallback */
 	{
 		.id = SND_SOC_FLAT_COMPRESSION,
 		.name = "flat",
@@ -1567,10 +1568,12 @@ int snd_soc_cache_init(struct snd_soc_codec *codec)
 	for (i = 0; i < ARRAY_SIZE(cache_types); ++i)
 		if (cache_types[i].id == codec->compress_type)
 			break;
+
+	/* Fall back to flat compression */
 	if (i == ARRAY_SIZE(cache_types)) {
-		dev_err(codec->dev, "Could not match compress type: %d\n",
-			codec->compress_type);
-		return -EINVAL;
+		dev_warn(codec->dev, "Could not match compress type: %d\n",
+			 codec->compress_type);
+		i = 0;
 	}
 
 	mutex_init(&codec->cache_rw_mutex);
-- 
1.7.2.3

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

end of thread, other threads:[~2010-12-21 20:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-21 17:10 [PATCH] ASoC: If we can't find a cache compression type default to flat Mark Brown
2010-12-21 20:28 ` Liam Girdwood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.